I have a problem in list.contains node. I have two lists. the first one has 9 elements and the second one has 2 items. I want to have a boolean list of nine elements where those two items list will be true and the remaining will be false. So, lis.contains node gives me only one true and the remaining of the list is false. I played already with lacing and still doesn’t work. Can anybody help me find out how to make it work with list.contains or any other node that can achieve the same purpose.
thanks,
Not sure why that isn’t working, I do most my list manipulation in Python (sorry in advance my coding is pretty terrible I’m self taught and still pretty new to coding)
There’s my example I used, where IN[0] would be your full list that contains all the items possible, and IN[1] would be the list of items you want to check are present in the full list.
Heres the code:
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
output = [False] * len(IN[0])
for i in range(len(IN[0])):
for j in range(len(IN[1])):
if IN[0][i] == IN[1][j]:
output[i] = True #Assign your output to the OUT variable.
OUT = output