algorithmic modeling for Rhino

Variable List Merge / "Overwrite" Positioned List Values From Another List

Hi folks,

say I have three (or more) identically long lists containing point coordinates with n items each:


and I now want to take i.e. the point coords on index position 8, 9, 10 from the other list and insert/splice them into the original list (at the specified index, not appended to the list end) while overwriting the values contained therein- how would I go about this task? Ideally, I could then, in a second step, take yet another range of indices (20, 22.. whatever) from another list and splice them in again.

Any thoughts?

Thanks & g'nite


Views: 1847

Replies to This Discussion

here's how I would do it:
1. graft all of the lists
2. merge them together (you will get a data tree containing n lists with 3 items each
3. create a new list with n integers, where the value is the index of the list you want to draw from for that index number.
4. graft the new list of integers
5. use the list item component, with the merged grafted lists into L, and the new list of integers into i.
6. flatten the resulting list.


list A: list B: list C:
100 200 300
101 201 301
102 202 302
103 203 303
104 204 304

Integer List:

list item component returns:

I hope this is clear enough - and close enough to what you were trying to do.

wow, that is very smart!! thank you so much! Never thought about using the tree structure to store alternate values in that way. I'd probably input the integer list(s) through a panel as if writing a "weave sheet" of sorts.

Have a lovely Sunday,

If you use the latest version of GH v0.7.00030 there is a list insert component and used in conjunction with the cull index component this would achieve what you want.
I think using branch names as an index would be the best way to go since if the branch names are formatted similarly merging will automatically combine them in the correct order.

Using the new insert list component would be slightly more work since after values are removed from a list the list length changes and so do the index values to reinsert the modified data.

But say the values you remove aren't consecutive, like if you remove 2, 5 and 7 and want to replace them with values in their original list location...

I always thought that the Stream Filter and Stream Gate components should accept multiple gate indices... anyway, so I wrote a really simple VB script about 6 months ago to accomplish the task. Given up to 4 lists of identical length, you provide a list of indices to tell the component which list to pull from for each index position. I use this extensively for mixing influence systems on a complex construction.


Is there a way to simply amend this script so that the filter indice denotes which LIST to return, and it's output from 'S' is a branch?


ie. with the panels used above would return


0 | 0

1 | 0

2 | 0

3 | 0

4 | 0

5 | 0



0 | A

1 | B

2 | C

3 | D

4 | E

5 | F



0 | 1

1 | 2

2 | 3

3 | 4

4 | 5

5 | 6


and so on...

Still helpful, thank you very much!

Hello Danny,

I'm making a script where I use the List Insert component also. But it isn't working the way I want.

I made an exact copy of your List Insert script from above, but my result is different.
Grasshopper is using the two lists alternately. See my image.

Do you know why? I'm using grasshopper version 0.8.0051

Thanks in advance,



this is all incredibly insightful, thank you! I'm glad there are so many variant methods.






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2023   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service