Python "Expected Array[float], got list" issue

Hi, can someone explain me how to handle this issue?

image

# Find trimed lines
tr_lns = Curve.TrimSegmentsByParameter(lns[0], int_prms)
# Assign your output to the OUT variable.

OUT = tr_lns

My input parameters look like this:

lns[0]:
image
int_prms:
image

Is something wrong with list? It it not array?

I think you need to create an array of floats from your list. Similar to this:

Look at the last third of this code. There will you see that an array of objects is created from a list. You need to create an array of floats.

Hello @denisyukj
a solution converting the input List

import sys
import clr
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

lns = IN[0]
int_prms = System.Array[System.Double](IN[1])

tr_lns = Curve.TrimSegmentsByParameter(lns, int_prms, False)

OUT = tr_lns
2 Likes