How Do Components Map DataTree Branches?

I have a single base plane containing some items (x) that should be mapped to (y) target planes. That should give me x * y items, or 12 in this example with a tree of {y; x}.

I also want to do this for n base planes, so my total should be = n * x * y, or 24 in this example with a tree of {n; y; x}.

I can’t figure it out. I get n * x items no matter how I structure them. (16.7 KB)

Any help is greatly appreciated.

like this?


So you have to group? You’d think with branches, you could use them to run a command like normal, just with all the {0} terms, then all the {1} terms, etc.

That would be {*;y}(x) but you are right, it’s doable with trees only, but you need to build a level-2 datatree.
Since you want to associate all items x for each plane y, you need to graft the planes Y. That’s the basic rule of GH.
Now the problem if you do that is that you end up with two trees of different levels. You can’t graft X, for two reasons : 1/ you don’t want to split the items in several branches and 2/ you’d end up with a different structure anyway. You have to duplicate the x branches as many times as there are y planes.

You therefore need to Graft Parallel (from Elefront plugin). (23.1 KB)

Also doable with native components but so tedious I don’t see the point.

1 Like

Thank you. And is the best way to solve the grafted version of this problem?

All the {n} level objects are related. Anything belonging to that initial relation is stored as a sub-branch {n;0}. Operations for sub-branches should map to their matching parent branch.

The only way I could do it is with Relative Items, allowing it to wrap the single item and duplicate it for each sub-branch: (24.6 KB)

Simplify ?
Or Trim Tree.

And if you really need to put back those elements in specific branches : Graft Parallel.