Joerg_M-E
(Joerg Meyer-Ebeling)
August 22, 2025, 3:39pm
1
Hi everybody,
it seemed easy but I don´t get it right.
I have a data tree with n branches. n is not fixed and may vary.
How can I easily add a list of data as a additional branch on the same level in the existing tree?
Thanks in advance … Jörg
add tree branch.gh (12.1 KB)
what about adding Graft to the second list.
Joerg_M-E
(Joerg Meyer-Ebeling)
August 22, 2025, 4:17pm
3
Because graft does it for all items end not only for the desired branch.
I also tried shift path, but I get
It requires dismantling the tree, then the path, adding one, then reassembling the path and assigning it to the data.
Not especially intuitive, especially the use of the Flatten component to assign the path! I’ve put a panel on each step so you can follow it through.
tree brranch added.gh (14.0 KB)
Won’t work because the source tree can vary in length (and so might the path length for all we know!)
i like toms solution. robust.
in cases when only a list is added and the tree needs adresses with one integer only i´d be lazy and go for something like that:
what about
Pushes all branches one up, and insert new as {0;0}
But we are expecting to make it the last branch I assume .
Tom_Newsom
(Tom Newsom)
August 22, 2025, 5:15pm
11
Also this breaks if the source tree has depth other than 2 (which it might - we’re dealing with synthetic data here)
Nice discussion. Meanwhile I worked on this:
It adds a branch to the end.
Reading your comment, I guess it is not hard to change this (list item -1) to add one to any list of branches (correct?)
regards, Eef
add tree branchEW2.gh (15.6 KB)
PS: I am trying to find a solution without breaking the existing structure.
As @Ali_Najmaei just did !
And one that adds to any list of branches
add tree branchEW3.gh (16.8 KB)
Please correct when wrong
Joerg_M-E
(Joerg Meyer-Ebeling)
August 23, 2025, 4:08pm
13
Hi Tom,
thank you, that is a sophisticated solution. At first I thought, I just overlook an GH component . As mentioned below by Jakob it seems to be robust. I try it that way.
Best, Jörg
Joerg_M-E
(Joerg Meyer-Ebeling)
August 23, 2025, 4:17pm
14
Hi Eef,
similar concept as Tom, but with “replace path” which I never used before. Nice.
Best, Jörg
Joerg_M-E
(Joerg Meyer-Ebeling)
August 23, 2025, 4:18pm
15
… and, no, I didn’t know that I can use “flatten tree” with Path. Learning a lot …