Grasshopper: duplicate list on each leaf of tree

Hi,

I’ve been banging my head on somethings for an hour, I need help.

I’ve got a tree like this:

{0} → 0, 1, 2
{1} → 3, 4
{2} → 5, 6, 7

I want to create a tree where each “leaf” item generates a new branch, and that branch contains the original list (from its parent branch). Like this:

{0;0} → 0, 1, 2
{0;1} → 0, 1, 2
{0;2} → 0, 1, 2
{1;0} → 3, 4
{1;1} → 3, 4
{2;0} → 5, 6, 7
{2;1} → 5, 6, 7
{2;2} → 5, 6, 7

Is there a way to do this ?

I have tried something with Tree Statistics, Duplicate Data and Tree Branch, and frankly I’m very surprised by what Tree Branch returns… I don’t know why it insists on concatenating branches.

1 Like

thank you !

just a note, with that, original branches get renumbered for data tree with uneven branching:

that of course is not an issue by itself, because GH generally ignores path addresses and just matches branches/lists/items on a one-to-one basis, so they could just be even plainly renumbered and for a general GH definition it will be just fine

but if you truly want path address to behave as described by OP even for slightly more complex data trees like the above, probably the further step of renaming each path is necessary:

Rename Duplicate Paths.gh (13.7 KB)

1 Like

I make shortcut?:


Rename Duplicate Paths vr2.gh (11.5 KB)

1 Like

Hi @inno,

The use of simplify on the partition list component can renumber the data tree.
This function is a bit tricky in most case. I recommend to use the component “shift path” instead to keep branches well organized.