Iterate over lists

I am guessing you have 2 sublists and really what you’re asking is how can you perform cross product lacing with sublist 1 against sublist 2?

Try this (this only works on a list with two sublists; if you are trying to match each item from sublist 1 with all items with sublist 2, then match each item from sublist 2 with all items from sublist 3…etc then this wont work and you should think about how to manage your data better)

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.
dataEnteringNode = IN

list = IN[0]

concat = []

for i in range( len(list[0]) ):
	sub = []
	for j in list[1]:
		sub.Add(str(i)+j);
	concat.Add(sub)

#Assign your output to the OUT variable.
OUT = concat
2 Likes