Hello mates, i tried to make a node that collect walls by type with python ! it works well the first time but when i add a new walls in the revit model and run the graph Nothing happen, i must deconnect the nodes run the graph then reconnect them and run the graph a second time to work ! i don’t understand why it doesn’t refresh automatically when running the graph !
some help would be great thank you
Hello Talbimam,
This is how the Python node works in Dynamo - It will only execute once, unless either an input is changed (Toggle the + icon) or the internal contents of the node itself have been changed (The code).
Even if there is new walls in revit model ?
You can use the “SpringsUI.Refresh” node to force a re-run of everything.
Personally I like coding in Visual Studio Code and use the Python Script from String, so that you do not have to close the python window on each rerun (though it does not have to be closed in Dyn 2.0) Another advantage is that you have linter.
I believe the node i mention have been integrated into the dyn 2.0 core environment
It might be better if you just use the built in node to pick up the walls and leave the graph in automatic node. The built in node subscribes to the document.Changed event and will re-execute and that will also force your python script to re-execute:
No Its not “Date.Time Now” was there in earlier version also
Oh have not noticed the ‘‘periodic’’ option in pre-2.0 i must have overlooked it
thanks
I feel blind, oh well, you learn something new every day.
Bear in mind that Periodic mode will re-execute the entire graph - so if it’s heavy, it may be a slow approach while it calculates (Also - it will hit an infinite loop, i.e freeze, if the time to run the graph is longer than the period).
I would just run with @Dimitar_Venkov’s solution.
You can use same script just add this at line number 21:
AutoRefresh = IN[1]
And connect Date.TimeNow node to IN[1]
Cheers!
thank you !
You’re welcome!
WARNING: Be careful with Periodic runs. If the amount of time to re-calculate larger graphs will lead to never-ending runs if the time to execute is longer than the refresh rate.
On a more positive note: I still love this post by @Zach_Kron in the geometric formulas in design script thread. Really inspiring use of periodic runs.