Hello,
I want to select the second layer, when there are severials. Take one layer if there is just one
like layercount == 1 ? getMaterial[0] : getMaterial[1]
My python code is still not finished…
# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
elemns = IN[0]
nums= []
container =[]
for i in elemns:
nums.append(len(i))
for x in nums:
if x <= 1:
container.append()
OUT = nums
KR
Andreas
Hi @Draxl_Andreas ,
Can you try the script like this?
# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Get the input list of sublists
elemns = IN[0]
# Create an empty list to store the 2nd items
result = []
# Loop through each sublist and get the 2nd item (or the only item if there is only one)
for sublist in elemns:
if len(sublist) == 1:
result.append(sublist[0])
else:
result.append(sublist[1])
# Output the list of 2nd items
OUT = result
2 Likes
Good morning,
here is
python script:
import sys
cont=[]
for i in range(len(IN[0])):
if len(IN[0][i])>1:
cont.append(IN[0][i][1])
else:
cont.append(IN[0][i][0])
OUT=cont
edit: nodes
Cordially
christian.stan
3 Likes