Connect points within one data structure

Hello,

I have a fairly simple question but I can’t wrap my head around it.
I am trying to find a way to connect the points within the same data tree as you can see in the picture (blue lines). I want to do it with the least amount of components.
My current solution is flattening the structure and partition it again, but this feels like a stupid idea because the data structure is already there. I have two different attempts but I just dont understand how I can prevent it from connecting all the points in a straight continuous line.
Gh-file attatched.

Thank you and have a nice day,

Fabian

ConnectPoints.gh (21.4 KB)

the fastest way is probably through the Relative Item component, where you can specify an offset and retrieve items from different branches of the same tree:


ConnectPoints_Re.gh (13.4 KB)

[edit] the offset {0;+1}(0) could be positionally referenced as {A;B}(i)
reading it right to left makes things maybe a bit more comprehensible (at least in my twisted mind… :smiley: )

i = 0 means “for each item at index i give me only items at the very same index i”
A = 0 means “for each item in a given branch, search only inside the very same branch”
B = +1 means “for each item in that sub-branch, search only in the next sub-branch”

when you put things together, it becomes: “for each item at index i give me only items at the very same index i from the very same branch, but from the next sub-branch”

because Wp = False (by default) items in {;0} will relate to items in {;1}, and items in {_;1} will relate to nothing because there are no more sub-branches to look into

3 Likes

Path Mapper

2 Likes

Thank you very much to both of you.
Something that looked so simple in the first moment to me, seems to be way more advanced then expected :slight_smile:

Have a nice weekend,

Fabian