I’m trying to get the output of _ExtractControlPolygon from a polycurve. I can match the output with a line, polyline, or single curve using Curve.ToNurbsCurve().Points.ControlPolygon().
But doing this with a polycurve is relocating and adding extra control points.
You don’t have to filter out the start/end points of each segment that are within tolerance of each other?
points = []
for j in range(polycurve.SegmentCount):
curve = polycurve.SegmentCurve(j)
if curve:
nc = curve.ToNurbsCurve()
if nc:
start = 0
if j > 0:
start = 1
for i in range(start, nc.Points.Count):
points.append(nc.Points[i].Location)
if len(points) > 1:
return Rhino.Geometry.Polyline(points)