Looking for an example using Rhino.Geometry.PolyCurve.ToPolyline()

Hi,

Looking for a python example using Rhino.Geometry.PolyCurve.ToPolyline(). Unsure of how to format the arguments?

Eric

example_crv.3dm (22.2 KB)

I’ve attached an arbitrary 3d curve to use along this script

import Rhino as rh

# pick the curve
r,oref = rh.Input.RhinoGet.GetOneObject("select: ", True, rh.DocObjects.ObjectType.Curve)
if r==rh.Commands.Result.Success:
    crv = oref.Curve()
else:
    crv = None

# convert
doc = rh.RhinoDoc.ActiveDoc
tol = doc.ModelAbsoluteTolerance
atol = doc.ModelAngleToleranceRadians
plcrv = crv.ToPolyline(tol, atol, 5,40)
pline = plcrv.ToPolyline()

# back to active rhino model
rh.RhinoDoc.ActiveDoc.Objects.AddPolyline(pline)

The question is really how do you want to convert a smooth curve to a polyline. The method also has two other overloads. Shown is just the first one.
https://apidocs.co/apps/rhinocommon/6.14.19118/M_Rhino_Geometry_Curve_ToPolyline_2.htm

Will,

Thank you so much. I’ll check it out.

Eric