Python node does not reset itself with each new run and change in Revit

Hello everyone,

I have managed to create a python node that retrieves the length unit of the current project and then convert a value of 20cm to the value used in the project (20 cm is just a tolerance value that I need).

The problem is when I hit run, the python node gives the correct answer. However, when I change the length unit in Revit and then go back to Dynamo and hit run again, the output does not change. It only changes if I open the python node and make whatever change, even making a space or a new line.

Sorry, I could not paste the code here because I cannot copy/paste from Dynamo with the current Revit version.

2

From the perspective of your Dynamo graph, nothing has changed and therefore it will not re-run any of your nodes. There are some workarounds such as connecting a boolean toggle to an input to the Python node like this:


Trigger.dyn (8.6 KB)

You could also look at something like @john_pierson did using the Dynamo API here. This only works if nodes are added or removed, but you may be able to have it trigger based on other events–although I have no experience with the Dynamo API so I’m not sure if it’s even possible to do that.

Well, theoretically, the node is input here is line 11, “format = …etc”. It should at each run retrieve the length unit used at this project proceed. It does so, only if I make change in the code and save it which is weird. By minor change I mean just pressing enter somewhere.

the answer of @john_pierson is to automatically run the node. I am running the node myself and still, no change in output is shown.

Anyway, thank you very much for the reply and I will try the trigger solution you have suggested.

Yes, the Python node will not run unless changes within it are made (even if you press the Python node’s own “Run” button, which is counter-intuitive).

1 Like