Trouble merging lists with different number of items/branches

Paths and path mapping remain one of my greatest challenges with Grasshopper… after a couple of years I at least understand how they work, but still sometimes struggle to get them shaped the way I need.

My current difficulty is merging two lists, one of which is just one branch with several items, and the other of which is a series of branches with a couple items each.

The goal is to take the first and last item from one list, the middle items from the other list, and produce one branch per item.

It’s hard to explain in text (reading the above makes little sense to me), so here’s an example with data: (12.9 KB)

That brute forces the data into the right shape, but relies on a hardcoded number of items. Note that where I’ve written “bad” in the source data, the actual data is not obviously bad and can’t be filtered with nulls or similar.

My immediate problem will always be taking the first and last item from Input 1 and all middle items from Input 2 (there may be more branches and/or more items in input 2). But what I’m really after is something like Pick 'n Choose, but which will pick all items in a branch.

Help please?

Like this? (white group) (13.4 KB)

I avoid Path Mapper like COVID-19. Entwine is very predictable.

Maybe I was too hasty using BANG! and you want a more parametric solution? What you really mean is: “taking the first and last item from Input 1 and all middle BRANCHES from Input 2”?

Using vanilla components:
I use tree stats to remove the first and last paths, then I add the first and last item to the tree, followed by a renumber. (16.9 KB)

2 Likes (16.6 KB)

1 Like

Yep —that paramicity is just what I was after. Going to have to study it to understand but that’s exactly what I need to learn. Thank you!

It’s my time realize the component’s nickname is BANG! :rofl:

1 Like

Got it – tree stat was what I was missing.

And thanks for the clever use of invert and naming the inputs … that is more clear that just setting values and simpler/less clutter than using a panel for input.