Polyline BreakAtAngles method not working in Python?

Hello,

I try using BreakAtAngles on a Rhino.Geometry.Polyline object made of segments aligned on X and then Y direction and the method BreakAtAngles is not returning the two sub-polylines that I would be expecting (returns the original polyline instead).

Here is what I tried:

 points = [Rhino.Geometry.Point3d(0,0,0), 
                Rhino.Geometry.Point3d(1,0,0), 
                Rhino.Geometry.Point3d(2,0,0), 
                Rhino.Geometry.Point3d(2,1,0), 
                Rhino.Geometry.Point3d(2,2,0)]
    testPolyline = Rhino.Geometry.Polyline( points )
    testSubPolylines = testPolyline.BreakAtAngles( math.radians(1) ) # 1 degree
    # Here, testPolyline == testSubPolylines!!!

P.S.:Here is the Rhino version I use: Version 5 SR11 32-bit (5.11.50226.17195, 2015-02-26)

You’re looking at the complement of the angle. Two tangent segments don’t have an angle of 0, they have an angle of pi radians (180°). This should work (breaks at 90° or under):

testSubPolylines = testPolyline.BreakAtAngles( math.pi/2 )

or

testSubPolylines = testPolyline.BreakAtAngles( math.radians(90) )

HTH, --Mitch

1 Like

Thanks! It works as you explained. The documentation was a bit confusing…