-
Notifications
You must be signed in to change notification settings - Fork 634
Python FAQ
Ian Keough edited this page Jun 17, 2015
·
2 revisions
Q: I get the error Type error. Expected Array[float], got list.
when attempting to put a Dynamo list into python.
A: If you receive this error, you need to make a typed array in Python and load it with the values from the incoming list. You can do this like so:
import clr
# Import System to get access to array creation methods.
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
curve = IN[0]
params = IN[1]
# Create a typed array.
paramsSingle = System.Array.CreateInstance(float, len(params))
# Load the values into your typed array.
for i in range(0,len(params)):
paramsSingle[i] = params[i]
# Use the typed array instead of the list.
OUT = curve.ParameterSplit(paramsSingle)
Looking for help with using the Dynamo application? Try dynamobim.org.
- Dynamo 2.0 Language Changes Explained
- How Replication and Replication Guide work: Part 1
- How Replication and Replication Guide work: Part 2
- How Replication and Replication Guide work: Part 3