Go back to tree after flattening to cull multiple curves?

Hi everyone,

I have this hypothetical case of multiple curves that I need to cull based on whether they intersect with any other curve. To do this I flatten the tree, but then I need to go back to my previous structure. Problem is some items have been culled, and thus the nunberes of items at the start is different than the one at the end. so unflatten tree or match tree cannot be used in this case.

What is the appropriate way to go back to my tree structure?
Thank you.

Cull Multiple Curves.gh (12.4 KB)

What is the use of your hypothetical case?

Cull Multiple Curves_re.gh (15.6 KB)

hmmm i got a different result.

Cull Multiple Curves_2.gh (13.7 KB)

get same results as @HS_Kim

Cull Multiple Curves_re.gh (15.5 KB)

Thank you guys! Will go with Kim’s solution. I tried to used item index, but was totally missing the next steps.

To answer Kim, the example simply mimics the problem I was having on a larger def. Tried it back there and it works perfectly.

Kim’s is a good bet, i could couldn’t tell you how Item Index finds index of the list, much less why mine isn’t corresponding.

oops, didn’t graft the original list.

1 Like

You want [Member Index]. [Item Index] is an awkward component which doesn’t test for value equality but memory equality. So instead of comparing two numbers to see if they have the same value it compares two numbers to see if they are stored in the same location in memory.

[Item Index] does two things that [Member Index] can’t:

It works on all data types, not just simple ones.
It can differentiate between different instances with the same value.

These are features though you will rarely need.

Had always problems with item index at work. That’s why I switched to member index and it never failed for me.

Its a bit of a magical component.