I am having some trouble with a basic python function, and am need of help.
Basically, I am working on a furniture plan, and just learned that some cubicle panels only come in certain lengths. I want to check to make sure that our plans only show the correct lengths and the incorrect ones are highlighted.
In dynamo, I have collected all of the cubicles and their widths. I want to check if any item in the list is equal to 54" (4.5’) OR 66" (5.5’). If it is, I want to be able to do Boolean Mask filter to separate the types.
My issue is that I am checking a list and it is returning a single item. I want it to replace the 54 or 66 values with “invalid panel” and the ones that don’t equal those items to be “valid panels.”
Here is my python code, and an export of my workspace, along with a text file of the panel widths.
Any help is appreciated!!!
numbers.txt (587 Bytes)
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 w = IN #condition for i in w: if w == 4.5 or w == 5.5: w = "invalid panel" else: w = "valid panel" #Assign your output to the OUT variable. OUT = w