I am working on a tool, that relies a lot on Offsetting curves parallel to the xy-Plane or perpendicular to the z-Axis.
99% of the time the code works fine, but sometimes I get unexpected results:
- Clean curves get offset into several curves.I noticed that raising the tolerance, usually helps to produce one single clean curve.
- Long curves (length > 1000mm) get offset into tiny curves (length around 0 mm)
- If I choose to offset the problematic curves manually with the desired parameters, it always works as anticipated.
Currently my code looks like this:
Usually curves will be the correct offsetCurve.
normal = Rhino.Geometry.Vector3d.ZAxis
tolerance = scriptcontext.doc.ModelAbsoluteTolerance
style = System.Enum.ToObject(Rhino.Geometry.CurveOffsetCornerStyle, 1) #Sharp-Cornerstyle
curves = curve.Offset(dirPoint, normal, dist, tolerance, style)
I choose the dirpoint far away from the curve into the desired X- or Y-Offset-direction.
Can anybody explain how to choose it correctly.
Will the "Curve.Offset Method (Plane, Double, Double, CurveOffsetCornerStyle)" lead to different results? If so which is the correct Plane for the offset?
Unfortunately the RhinoCommon documentation is not much of a help here, maybe it can be expanded with an example.
Thanks and best regards