Stop Executing Node Tree

Hi,
I have the problem, that I don´t want to execute some Nodes when I don´t need them. Currently, I input empty lists into the inputs, but the nodes run anyway. Some nodes the even spit out an error when the input is empty which is confusing for the user, because the Dynamoplayer shows an error which isn´t one.

My wish is a “Filter” like that:

Is there a way to stop executing the nodes of a specific Node Tree somehow?

Kind regards,
Jannis

My setup lo

We had the same problem and used Data Shapes UI. The step is only executed when the correct input is included.

An additional advantage is that the script is faster by using UI.

Hey :slight_smile:

I don´t really get the difference / advantage with using Datashapes UI.

I use the Datashapes UI a lot, but how does it affect the execution of the node trees? In my experience I can add a popup with a selection, but the only thing I can do then is executing the other trees anyway, but without an Input, which failes for some OOTB-Nodes, or is the datashapes package even better than I thought?

Hey :slight_smile:

You can use an if to set the toggle of the next input to false, so you let go of this data and it doesn’t do anything with it.

This is what you are looking for right? Or am I misunderstanding you?

As below:

if the value is equal than use the true, when he isn’t use null

1 Like

Thanks for the screenshot :slight_smile:

Unfortunately, that´s not exactly what I want, because Dynamo executes all Nodes, no matter what the input is.

In C# I could just put a “return” in the main function, for example when a Datashapes Popup is cancelled. In Dynamo all nodes get executed anyway which takes time and creates errors.

For example an error occures when I input an null / an empty list into an “Element.Geometry”-Node
image

If I could stop this tree path from executing I would be able to create clean outputs without errors, running the dynamo player.

Ah that way, my bad…
We have had the same issue with titleblocks, the family name changed with a different version. We have solved this with a Custom node.

Unfortunately, I have no other solution…

2 Likes

Exactly. There is no real way to “stop” nodes from executing, but you do have a few options for avoiding warnings and errors. Passing Empty Lists is sometimes enough to avoid warnings, but you can still run into issues this way. Python is great if you can wrap everything up in a single node. The same goes for custom nodes (as @jw.vanasselt mentioned) which are usually easier to manage than a full python solution. As long as the warning/error is contained within the custom node, you shouldn’t have any issues.

3 Likes

Thanks @Nick_Boyts for affirming what I was suspecting :slight_smile: I hoped there would be another way to stop these nodes from executing at all.

I think I will write python nodes for the problematic node trees in my script and stop them with a simple bool.

If someone knows a better way, please tell me :wink:

A custom node wrapping the entire branch would be far easier to build (select all the nodes on a given branch, right click the workspace background, create custom node) and maintain. Remember that python will need to change to a .net implementation written in Python 3 in the coming years, and that will have to happen in every version of the graph saved everywhere it will ever be used again… while the custom node is likely to keep itself updated as nested nodes update. For a custom node you just need to deploy the code in your own package, and/ or have users get it themselves via package manager or off the network.

1 Like