Stop running a branch of script if list is empty

dynamo

#1

Dear All,
please help me. Dynamo script is taking too much time in process the data of my entire script that involves several object categories.
Is there any way to stop running a “branch” of script if the list of the element is null?

Thanks in advance
Marco


#2

Hi Maroc,

I think what you need is list filer by bool mask, here is an example how to use it:

also, you can use unconnect wires from some nodes, the things that take time, anything creating heavy geometry or with cross product lacing and huge number of indices,

and you write click any node or group of nodes and select “Freeze” to stop it working, and of course you should be running the workflow on manual mode, every few connections, hit run and continue until you reach the end

I hope this helps :smiley:


#3

Thanks, but unconnect or freeze can’t work for me since I need to run the script from dynamo player.

My requirement is to stop a branch of script if the list of the element is null/empty. Processing all phases when the list is empty takes time that i need to cut in the earlier stage.

Thanks anyway.


#4

@marcomella, you could try using the IF statement like this:


Or look into the “Tool.RunMe” node inside the SteamNodes package.


#5

Processing an empty list will usually throw an error and take nano seconds on all the nodes thereafter as they will all error. This won’t save you any time as a result. Look into simplifying the script another way.


#6

Tool.RunMe solved my problem.

Thanks a lot