Filling parameter values in Dynamo --> double entry in Revit

I was able to get dynamo to create a new project parameter named “Testparameter”.

As I now tried to put a value in the parameter for all elements, Revit doubles the parameter everytime I run the Dynamo script. I think this is due to the fact I used the “Set Parameter by Name”.

Is there another possibility to fill the parameter values?

Thanks in advance

I have tried your script and the parameter is being created only once for me. However, when I re-open the script and run it again for the same categories, the script does duplicate the parameter. This is happening because you are using the node Parameter.CreateProjectParameter. This will create a project parameter everytime you re-open and re-run the script. If you only want to set the parameter value, try to re-use only the algorithm you have going on below with the Element.SetParameterByName.

Hope this will make it more clear:

Thanks for your answer! This helps a lot but I still haven’t figured out how to first create a new parameter and then fill it with a value.

If I only use the bottom part of my script (setparameterbyname), I get the warning that there is no parameter to be filled.
So I guess I first have to create the parameter but I don’t want it to be doublicated everytime I re-open/re-run the script.

Two things to add:
1- find if the parameter exists in Revit, if yes does not do anything, otherwise creates the parameter
2- link the two tasks with the node “Passthrough”, ie: first create the parameter, then fill it

  1. If you run the upper-part of the script you create the new parameter.
  2. If you run the lower-part of the script you set the value of the existing parameter.
  • This would mean you didn’t run the upper part of the script to create the parameter in the first place.
  • Why do you re-open and re-run the script? For new elements you add to the project which don’t get the new parameter?
  • Why don’t you make two seperate scripts where one only contains the upper part and one only contains the lower part of this script? (One would create parameters the other would only set values for existing parameter)

Otherwise try the option that @Akli.baliche mentioned. The script will be a bit more intelligent and recognize if the parameter exists or not before it creates the parameter.

I had some spare time at work so I checked what I could do with your script.

test tanja1309 V2.dyn (23.7 KB)

This should only create the parameter if it doesn’t exist on the element already. :wink:

1 Like