So this is feels like a basic question, but it makes me realize that i’m probably missing something fundamental about how to write python scripts for dynamo.
i’m trying to write a script that will make a list of strings describing the detail level i want to associate with different scale values. The input is the output of Element.GetParameterValueByName, which should be a list of integers(?) Part of my problem is that i don’t always know what data types are coming out of the various dynamo nodes.
> 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.
> scales = IN
> dL=[]
> # create a list of strings based on the value of values in the list scales
> for s in scales:
> if s<=48:
> dL.append("Fine")
> elif s<=96:
> dL.append("Medium")
> else:
> dL.append("Coarse")
> #Assign your output to the OUT variable.
> OUT = dL
when the code runs, i get a list with length 1, and the value “Coarse”
I’ve tested the code in the python shell, and it works as intended, so i think i’m misunderstanding something about how the inputs to the python script block are structured.
What am i missing here?