Why is this happening?
export.3dm (27.6 KB)
Why is this happening?
Folded back on itself? Check the end/control points…
no, that’s the thing it’s not folded
this curve is not caught by SelDup
You’ll have to _ExtractPt to create the duplicate or stacked control points.
Do you mean it should _SelBadObject?
SelDup does not find stacked control points. SelDup does find duplicates of point objects. Control points are not individual objects.
_Convert to be able to fix the curve.
Any ideas what RhinoCommon method is used in there?
Thanks for the suggestion @Gijs
It turns out Simplify doesn’t work with Polylines
sorry I think it should be this one:
The original posted above is a degree 5 NURBS curve - SimplifyCrv seems to work on that to simplify it to a line…
Yeah, I changed my strategy instead of using Silhouette I decided to use Mesh.GetOutline. That changed my result from curve to polyline.
SimplifyCrv seems to be able to merge colinear segments of polylines here… However, it uses a hard-coded (very fine) tolerance here for the angle below which adjoining segments are considered colinear. With Convert you can specify a tolerance. The RC version of SimplifyCrv - Curve.Simplify() does have both distance and angle tolerances as arguments.
_ = _.ToPolylineCurve() _.Simplify(Rhino.Geometry.CurveSimplifyOptions.All, sc.doc.ModelAbsoluteTolerance, sc.doc.ModelAngleToleranceRadians)
I don’t see any effect.
I need to convert this polyline somehow to something instead of just putting it in PolylineCurve “container”
Post the curve?
Rhino 6 or 7?
I’m testing this in RhinoWIP
OK, 7 then.
culprit.3dm (31.0 KB)
if you use the
Convert command on this result is what I expect from Simplify
SimplifyCrv (native Rhino) gets me this:
That extra point is there because it’s actually the curve start point and Simplify does not cross start/end points if the curve is closed - one would need to move the curve seam to a corner to get rid of it. I will look into RC in a sec.
So, try this on for size:
import rhinoscriptsyntax as rs import scriptcontext as sc import Rhino crvID=rs.GetObject("Select your curve",4) if crvID: crv=rs.coercecurve(crvID) rc,pl=crv.TryGetPolyline() if rc: pl.MergeColinearSegments(sc.doc.ModelAngleToleranceRadians,True) sc.doc.Objects.Replace(crvID,pl) sc.doc.Views.Redraw()