Conditional Tree Trim

I am using trees to build geometries. I need the output of each geometry to follow a format {0}, {1}, {2}, bearing in mind that {2} and {3} may be empty. The problem I have is that often some geometries end up in a {0.0} format instead of {0}. This happens when branches {1} and {2} are empty. It happens after a move component.

I can use trim tree to fix this and shift {0.0} to {0}, but I have to create a long suite of components to make sure that the depth of the trim tree component becomes 0 when trim tree is not required. This suite of components is: Param Viewer > Depath > Branch > Length > (x-1). This suite of components will return either 0 if the path is already {0}, or 1 if the path is {0.0}. See below:

I would like to find a way to simplify this suite of components, because I need to use it quite often. Maybe a C#? Maybe using masks? Maybe an expression? I am not too sure.

Thanks!

Hello,like this? Or you can use Cluster.
RenumberPaths.gh (11.3 KB)

Thanks! But I’m missing the plugin to view the C#. What’s the name? I think I read something like “Rhino Code C# Plugin” but can’t find it. :upside_down_face:

I managed to use Cluster, thanks for the tip!

1 Like

C# is available as a standard Component.
The one shown earlier was created for Rhino 8.
A version that can also be opened in Rhino 7 is attached.

Edit: Uploaded again.
RenumberPaths_V7.gh (10.1 KB)

1 Like

Hi. I am also interested in this component but seems like the download link it is not working? Thank you.

Just use Suirify. No need for scripts or clusters.

1 Like