How to scale a curve in Rhinocommon


(Shahid Ghouse) #1


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…

(Shahid Ghouse) #3

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


(Shahid Ghouse) #5

I saw that but the I get the following

(Shahid Ghouse) #6

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…

(Laurent Delrieu) #8

You wrote dupicate not duplicate you miss a L.


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)

(Shahid Ghouse) #10

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