Can't find the way to change this node into a python script

Hi I want to create a Project Parameter only if it doesn’t exist in the document. If it exists I don’t want dynamo to run the “CreateProjectParameter” node. But this node doesn’t have any true/false input to prevent it for been executed if the parameter already exist, so everytime that I run the dynamo it creates the parameter again and again. I CAN NOT use any package, so I was thinking of using a dynamo script, however, I don’t know programing that much (I know basics). Can any one can help me or show me how can achieve this task, either with dynamo nodes or dynamo scripts.

I also tried making it code and apply an if condition to run the “CreateProjectParameter” line only when the result of the previous nodes are true

but it doesn’t work. Even if it is false it always create the parameter

image

@rafaelPD66Z ,

in you picture… you use a codeblock! thats just for designScript

Check out this

KR

Andreas

Hello, maybe try this way

Cordially
christian.stan

Hi @christian.stan it actually does the task. It is a simple and effective solution. However, it creates a warning message, which is not a big deal, but if there is any way to avoid the warning?

1 Like

you can consult this topic, should meet your expectations

edit

edit: with Mr. Nick’s script and additional explanations on the modification according to the Python Engine Used (the names of the code blocks are important)

Cordially
christian.stan

You haven’t provided an input for Spec Types as the warning mentions.

1 Like

That’s excellent. I didn’t know you can freeze nodes in real time. Thank you so much

1 Like