_ExtractControlPolygon

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.

_ExtractControlPolygon.Help.3dm (52.7 KB)

Hi @EricM,

This should produce what you want.

Eric.py (1.3 KB)

– Dale

1 Like

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)

No you don’t.

– Dale

I’ve added something to make this easier.

https://mcneel.myjetbrains.com/youtrack/issue/RH-83271

– Dale

1 Like

RH-83271 is fixed in Rhino 8 Service Release 11 Release Candidate