Adding New List in a List of Lists with List.Insert

I have a list of lists (The list at the top right of the picture).

I want to add more lists to that list at the defined index (Python Script node).

The lists I want to add will be single item lists with the elements at the bottom middle of the screen (List.GetItemAtIndex).

Can you use the ‘List.Insert’ node to create a new list in a list of lists?

I ended up using some Python here to get the result I was looking for. See the code below.

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.

pointlis = IN[0]
indexlis = IN[1]
indexpointlis = IN[2]
count = IN[3]
out = []
# Place your code below this line
i = 0

for i in range(count):
    place = indexlis[i]
    pointlis.insert(place,[indexpointlis[i]])
i += 1
		
# Assign your output to the OUT variable.
out = pointlis

OUT = out

1 Like