I would love to be able to have (2) lists created, with (4) points in each sublist (current output has data structured within too many list levels). I know I could easily utilize the flatten command using levels, but there has to be a way to do this in the python script as well, right?
It’s not the most elegant or pythonic way but it works:
# 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.
mList = IN[0]
for i,v in enumerate(mList): #Add the odds onto the evens
if i % 2 == 0:
pass
else:
for sv in v:
mList[i-1].append(sv)
ind = range(1,len(mList),2)
ind.reverse()
for i in ind: #Delete the odds using .pop()
mList.pop(i)
OUT = mList
# 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.
mList = IN[0]
ind = range(1,len(mList),2)
ind.reverse()
for i in ind:
temp = mList.pop(i)
for v in temp:
mList[i-1].append(v)
OUT = mList