Manipulating tree and conditionally adding items (Rhino 7)

Good morning,

This is a problem for Rhino 7.

I have a tree with multiple branches and like to split each branch/list (“partition”) and add one item in between whenever the list length of each branch is greater than 2 (or equal 4 in this case). The tree structure should remain the same afterwards (19 through 32).

Is there any simple way to accomplish this? May by using “Split Tree” and “Combine Data”?

Thank you.

wieman01

Adding points.gh (7.9 KB)

Have a look at the attachment.


Adding points_re.gh (17.0 KB)

2 Likes

Thank you, @HS_Kim!

That is pretty ingenious! I was not aware “Merge” would work this way together with “Dispatch”. That is beautiful because of its simplicity.

Have a great day, my friend!

wieman01