Struggling with IEnumerables

I have reviewed the other posts about IEnumerables and tried to recreate previous examples but the sample codes still fail.

    import Rhino.Geometry as rg
    from System.Collections.Generic import List

lots of code which works

Then a branch…

    points = [rg.Point3d(0,0,0),rg.Point3d(10,1,1)]
    ptsList3d = List[rg.Point3d](points)
    print (points, ptsList3d)
    BetaDistCrv = rg.Curve.CreateInterpolatedCurve(ptsList3d,3.,0.,vecZero,vecZero)
    doc.Objects.AddCurve(BetaDistCrv)

output System.Collections.Generic.List[Rhino.Geometry.Point3d]

[
 <Rhino.Geometry.Point3d object at 0x0000021846F61A80>,
 <Rhino.Geometry.Point3d object at 0x0000021846F89140>
] 

and error:

TypeError: since Python.NET 3.0 int can not be converted to Enum implicitly.
Use Enum(int_value) in method Rhino.Geometry.Curve CreateInterpolatedCurve(System.Collections.Generic.IEnumerable`1[Rhino.Geometry.Point3d], Int32, Rhino.Geometry.CurveKnotStyle, Rhino.Geometry.Vector3d, Rhino.Geometry.Vector3d)

I have written thousands of lines of Rhino Python code that run on Rhino 7 and earlier but cannot get beyond this silly problem.

Thanks
Dennis

The error appears to be complaining about the enum passed to CreateInterpolatedCurve. Instead of passing 0 for the third parameter, try passing

Rhino.Geometry.CurveKnotStyle.Uniform

1 Like

That worked!

fail: BetaDistCrv = rg.Curve.CreateInterpolatedCurve(ptsList3d,3.,0.,vecZero,vecZero)

success: BetaDistCrv = rg.Curve.CreateInterpolatedCurve(ptsList3d,3,rg.CurveKnotStyle.Uniform)

Thanks for the quick reply.
Dennis

1 Like