Get Tree branch indices

Hi,
I have a list in Grasshopper which looks like this:
{1;3}
Mesh 1
Mesh 2
{2;3}
Mesh 1
Mesh 2
Mesh 3
{3;3}
Mesh 1
Mesh 2

Is it possible to get the indices of those tree branches. I would like to get a list that looks like this:
{0}
1
1
{1}
2
2
2
{3}
3
3

Thanks for your help.
Laurin

You just want a text representation of this?


list from tree.gh (28.8 KB)

What is this good for?

-Kevin

Yes, exactly. Found the TreeStatistics component in the meantime as well.

We developed a C# component that returns the meshes which represent floors in buildings in the branches. So all meshes in {1;3} belong to level 1, {2;3} to level 2 and so on.
I need this information to attach it as a parameter when exporting to Speckle.

If so … get this as well (notify if you want far more complex stuff for the “conversion” - like using some Class + P/LINQ for monitoring the “state/properties” of Meshes [the pro way to cut the mustard]).

DataTrees_PathsItemsReDo_V1.gh (8.7 KB)

@PeterFotiadis makes a good point, if you’re using a C# component to arrange your meshes as branches in a DataTree why not just capture the path information there?

-Kevin

Plus - general case - given a suitable Class you can assign any Property to any Object (like ownership, spaces, adjacency data, usage, utilization, material finishing data, HVAC etc etc) and then issue any Query imaginable: like find floors in buildings with more than 40 floors that have 6 spaces each having more than 3 neighbors that have this type of usage and finish etc etc). Or find the most visited rooms where live 2 cats and 4.5 dogs … blah, blah

Thanks for your answers.

That is also the plan to assign properites to objects in future versions. However, in the current version we don’t have it and therefore I needed to find a different way.

list from tree_2023Feb1a

1 Like