Rhino 8 - Enum error using rs.TrimCurve()

Hi,
The script was working fine in Rhino7 but now getting problems in Rhino8.
Just create a long polyline (>700) and select.

import rhinoscriptsyntax as rs

def cCrv_filt(rhino_object, geometry, component_index):
    return rs.IsCurveClosed(geometry)

def start():
    msg="Select a polyline for trimming"
    cCrv = rs.GetObject(msg, 4, preselect=False)
    if not cCrv: return

    out_arc_in1 = rs.TrimCurve(cCrv, [0, 700], True)

start()

TypeError: since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value) in method Rhino.Geometry.Curve Trim(Rhino.Geometry.CurveEnd, Double)

The error message is less than helpful. I think you can make it work by using floating points instead of integer values in the TrimCurve domain, like so:

out_arc_in1 = rs.TrimCurve(cCrv, [0.0, 700.0], True)

This means that you keep the first 700 units of your curve; I assume that is what you want.

Solved. INT params in TrimCurve will work in RHINO7 but not in RHINO8, only Floating Points

1 Like