Multiple tree operations for Relative Item Component

I having multiple surfaces of similar type. I am dividing each one in the same fashion. Now I want to use relative item to create the desired lattice structure. How do I do it ? its a 2D lattice structure operation, so Relative item component only.
When doing in the regular fashion, relative Item gives error. See script. Here I have extracted only 2 surfaces out of all the required ones, just for trial purpose.

Relative Items Issue.gh (76.0 KB)

{0;+1}[0]

1 Like

Oh Wow! I didn’t know that syntax. I am inquisitive to know what that means and how it works. Could you elaborate more please. This could be of help to me in future for other tree operations as well. Thank you so much @Quan_Li !

Paths in Grasshopper are ordered sequences of non-negative integers. They are denoted using curly brackets and semi-colons. For example the simplest path (a single zero) is written as {0}. A more complex path featuring three elements might look like {0;21;5}.

In C-style languages indexing is denoted using square brackets and zero-based integers. For example the first item in a list is accessed using [0] while the twelfth item looks like [11]. Grasshopper borrowed this convention for items in tree twigs.

So a notation as posted by @Quan_Li {0;+1}[0] means that within the context of a datatree whose paths all have two elements, each item in the tree can be associated with another item which has the same first path element, an incremented second element, and the same item index.

A more involved mapping notation might look like {+2;-3}[+1]. If we apply this mapping to an item at {5;8}[11], the item it will get paired up with will be {5+2;8-3}[11+1] or {7;5}[12].

6 Likes

Wow! That’s great explanation. Thanks @DavidRutten for helping me understand that. I knew only the basic single Path & index mapping syntax for such operations. This has opened a vista of possibilities for me.
I think it will take some time for me to fully understand this, and I might come back with more questions.