Have "merge" component output list order according to input order

(Thomas Peugeot) #1

This post suggests a minor evolution of the “merge” component.

The “as-is” situation is that output order is not following the input order. There are cases (Does the "tangent curve" component confuses input order?) when it might prove confusing.

Suggestion : the output order of the “merge” component should not be a runtime decision by GH, but rather a compile time decision from the specification, hence the input order.

Does the "tangent curve" component confuses input order?


// Rolf

(qythium) #3

I opened the gh file from your original post, and it looks like the ‘bug’ was actually expected behaviour due to your D1 / D2 inputs being on different branches:

and if you unflatten the output this is what you see:
The two lists were never merged in the first place- flattening the output obscured that fact and made things confusing by respecting the branch indexing order.

In your case, all you have to do is flatten the inputs to get things in the desired order:

(Thomas Peugeot) #4

Thank you qythium. Sorry, I’m still on the learning curve with trees. Next time, I will think about output elements in a panel.


@Peugeot Actually this is a common mistake, when tree branches are reduced to a single item, or a single list, it is not obvious to figure out which one is going where after the merge.

If you’re interested, I’ve developped a small component which takes a variable number of lists and output them back to back in a single list, in order. It’s definately not rocket science but if you need it, I can share it with you.


(Thomas Peugeot) #6

Thks @Xavier_Ayme. I would be interested.

(Yafim) #7

I would be also interested in that component @Xavier_Ayme.

I have a situation where there are 5 lists of 30 points each, corresponding to 5 divided curves, and I want to merge them with a 6th curve in which I’ve ‘shifted’ the indexes of the points.

For now the result is a list with 6 items, but the itex index 0 has 60 points, not 30.

Any ideas?


Hello @yafim, can you please share a small scale definition of what you are trying to do? I don’t quite understand but I am sure a small script could solve it.

(Yafim) #9

Thanks @Xavier_Ayme, attached is the script. I’m sure it’s a simple solution I’m just missing something probably.
Would be great if you can help.

02.01.19_Isocurves_on_surface.gh (10.8 KB)


Here you are : 02.01.19_Isocurves_on_surface_Xavier.gh (16.8 KB)

Actually a Path Mapper did the trick. Since the list you were trying to appen was at index 0, I just incremented all other indices of the tree by 1, leaving the 0 index free for the new list.