Appending and prepending a branch

This is how I do it, feels like a hack:


2024-04-30_appending_and_prepending.gh (13.7 KB)

Is there no simpler way?

I need this a lot.

Why don’t you just plug the three inputs into an entwine component?

Thanks for the suggestion, but how?

(In both cases, it’s two inputs, the tree and the branch to prepend, and the tree and the branch to append.)

Check out the Treesloth plugin. It has some excellent nodes, like the “Stack Trees” node, which does exactly what you need.

2024-04-30_appending_and_prepending_treesloth.gh (19.7 KB)

Edit: Okay, I noticed it doesn’t do EXACTLY what you had before, where there is a leading 0 branch, so I added a Prepend Element, also from Treesloth, so it matches.

Thanks, that looks interesting! Although, I think for now I’ll stick with my solution, maybe drop it into a Hops function. I try to avoid plugins where I can.

Yes, and I just learned today that this leading brach is a trunk. {0}, {1}, … is a forest vs. {0;0}, {0;1}, … a tree. (more a note to myself)

1 Like

How about with C#? same algorithm for both cases.


240430_renumberPaths.gh (11.8 KB)

1 Like

240431_renumberPaths.gh (11.8 KB)

1 Like

The C# part of this is quite elegant, thanks for showing this option!

Thank you! It’s good to see how to make use of Entwine for this problem. Thanks also for an alternative C# solution.

After seeing replies from experienced users, I conclude that there is no simple solution out of the box. I think I stick with my own solution for now.

2 Likes

@feklee you could previously merge it.

1 Like

Oh, I like that, thank you!