How to scale a curve in Rhinocommon


I wish to scale a polyline from the center point uniformly. All the methods I have seen so far return a boolean and not a scaled geometry. Can somebody please help?

If you use a scale transform and then use polyline.Transform(xform), yes, it does the transformation “in-place”, the Boolean indicates success or failure. To have a scaled copy, create a new instance of the polyline and then transform that…


Edit: changed transform to scale around polyline center point…

Polyline does not have the Duplicate method @Helvetosaur. Thanks a lot for the help!

I saw that but the I get the following

The work around is to set the type hint as a curve. That will allow duplication but then the centerpoint method won’t work

OK, I didn’t know you were running in Grasshopper… Let me look…

You wrote dupicate not duplicate you miss a L.

1 Like

Just remember, there is also a difference between a Polyline object and a PolylineCurve object. The first is essentially just a list of 3D points, while the second is a real curve object. If you want to output the curve, you will need to transform the scaled polyline into a PolylineCurve, otherwise you will just get a list of points as output. (6.7 KB)

Thanks a lot for helps everyone! I managed to do this like so