Create Project parameter - Repetition creation of parameter with each run

I use Parameter.CreateProjectParameter then I use Element.SetParameterByName to import data from Excell.
However, the Dynamo creates the Parameters again and again with each run.
I wish to stop that so I can create Project Parameter one time and import data from Excell many times



@YoussefIbrahim

Are you including both workflows for adding the project parameters and the data in the same script? If so, you’ll want to connect the output (void) from the Create Parameter node into something to start/not start the next action.

I have a few suggestions.

  1. If you use Shared Parameters, then you won’t be able to add that parameter multiple times to a project. This also has the added benefit to allow you to have the space data in a schedule or tag.
  2. Consider restructuring your inputs so that you can use a single Create Parameter node
  3. Include an error checking section. Which would basically say: IF the parameter exist in the project, don’t do anything, otherwise, add it to the project.
1 Like

@danielU3R39 thank you so much.
I chose the first approach “use Shared Parameters” and it perfectly works :wink:.

@YoussefIbrahim

Great, I’m glad that it worked. However, once the shared parameter is created in your Shared Parameter file, you don’t need to create it again in the next project. If you do try to, Revit may create a warning or its probably, it will also crash your script.

I therefore suggest using this shared parameter, instead of creating it, each time you run the script.

And again, using an error check section whether the shared parameter exists in the SP file, and whether it exists in the project with the right category.

The more error checking you have in your script, the less likely it will crash, or fail.

Again, good luck

1 Like

alright thank you, I will separate the script to two scripts one to create the shared parameters and one to run the script thus I can share the scripts with our project parties.
what do you think about this approach @danielU3R39?

Sounds reasonable to me. Glad I could be of assistance

1 Like