Dynamo Elements and Python Script "Order of execution"


#1

Currently i have 14 Python scripts reading data from sheets on excel, each one doing things differently, like building Stairs or Walls or Openings…

But it seems they all execute at the same time, this is a problem when you try to draw a stairs for example because you need that the document is not being used. So there is a way to make it execute in a order? For example, first execute Group 1 than Group 2… ?


#2

Perhaps you can stack them up in a linear fashion. Then, try setting up a bool test (use your imagination here) that that takes the first value from the first cell of the first excel file that is read, if the value is not empty, then it passes the “file path” string through so that the second excel function can be read…etc…etc…etc. In this way, the second excel read function won’t even have a path to read from until the first excel read function has completed.


#3

It sounds like the results of all of your scripts are getting committed in Revit in one transaction. This is the default behavior of Dynamo. It is not that they are being executed at the same time, just that the transaction which wraps all of them is being committed and all of your script-applied updates are attempting to reconcile in Revit simultaneously. At that point, I’m pretty sure you won’t get the ordered behavior you desire.

Have you tried using the Transaction.End node? This will commit the transaction of any branch of the graph plugged into it. Downstream nodes will be executed in a new transaction. Any time you want to commit a transaction and have the results of your scripts applied in Revit, you can use a Transaction.End.