Find tree branch and index

datamatching
grasshopper
rhino6
grasshopper2

(Jack) #1

Hello guys,

I have a list of numbers that I have obtained after performing certain Boolean functions. I know for a fact that these numbers occur in a data tree that I already have. I would like to know the branch path of the tree and at what index that item is. Is this possible?

I’ve tried using member index and playing around with it, but somehow it is giving me extra branch paths.

Thanks in advance

find tree branch and index.gh (11.1 KB)


#2

This could be one way, BTW there might be more simpler ways…

find tree branch and index_re.gh (14.0 KB)


#3

Same result…

find tree branch and index_reV2.gh (16.9 KB)


(Jack) #5

hello, thanks for the reply,

I tried modifying it a bit because that wasn’t exactly what I was looking for. I want the output to be such that I can directly plug it into the tree branch/tree item component to get a specific value. Almost like a list item component but for items in trees.

I still couldnt get it quite right, I dont know exactly how the replace path works. I couldnt get the list to come out in the original order, it seems to be coming out in an ascending order.

Thanks


find tree branch and index_rev3.gh (13.7 KB)


#6

You can use sort to modify the order, but …
I really don’t know why you want to get back to the same list that you have already found using list item through a difficult process. I don’t understand…

find tree branch and index_rev4.gh (16.8 KB)


(Jack) #7

Thank you so much!

Sorry for not telling you the whole picture, it does seem silly to get the original data after performing various tedious operations, making it seem pointless.
But it’s actually not the same list that I want to match. Instead, it is a list that has the exact data structure as the originally supplied list.

So, I used your method and ran that new list through to get the desired outcome.

I thank you again for your time and patience, it is much appreciated! :smile:

find tree branch and index_rev5.gh (19.8 KB)