I did a comparison and the results are close!
(except that the built in function is MUCH faster… ) )
Here’s the script for the built in function:
import rhinoscriptsyntax as rs
import scriptcontext as sc
crv_ids = rs.GetObjects("Polylines to make simple",rs.filter.curve, preselect=True)
if not crv_ids: return
tolerance = 0.1
tolerance = rs.RealBox("Tolerance?",tolerance,title="Simplify polyline", minimum=0.001)
if not tolerance: return
for crv_id in crv_ids:
crv2=crv.ToPolyline(crvTol, angleTol, 0, 0)
crv3 = crv2.ToPolyline()
I updated it to work on curves too, not only polylines.
@Helvetosaur do you know why I have to run ToPolyline to times and make new curves of the results?
I expected this to work but it didn’t:
crv.ToPolyline(crvTol, angleTol, 0, 0)