Hi there,
I noticed that the ‘Curve.Offset()’ rhinocommon method behave weird when the CurveOffsetCornerStyle.None is set.
By offseting one single segment open NURBS curve by 60 and 360mm, I get the following results:
- Rhino command and CurveOffsetCornerStyle.Sharp:
Similar fine results for these two methods: result curves are singles open NURBS curves. - CurveOffsetCornerStyle.None:
Here the offset produces a PolyCurve. Why? There is no corner in the input curve, the structure should also remain the same.
Moreover, when I run the ‘EdgeSurface’ command on the two resulting curves, the resulting surface of the CurveOffsetCornerStyle.None option are pretty bad:
Please also find the sample file here: CurveOffsetIssue.3dm (89.7 KB)
More generally, I find that the rhinocommon Offset method lacks of features that the Rhino command version offers:
- ‘Loose’ offset: it would be handy to have some option to do it in the SDK, rather than to move control points manually. Maybe by setting the tolerance value to 0 (similar to Brep.CreateFromOffsetFace)
- ‘Cap’
- ‘BothSides’: offset would return two
Curve[]
instead one.
An upgrade of the SDK method to match the command possibilities would be welcome.
Thanks in advance.
C# sample code used:
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var rc = Rhino.Input.RhinoGet.GetOneObject("Select curve to offset", false, ObjectType.Curve, out ObjRef objRef);
if (rc != Result.Success)
return rc;
var curve = objRef.Curve();
var offsetResult1 = curve.Offset(Plane.WorldXY, -60, 0.01, CurveOffsetCornerStyle.Sharp); //PolyCurve result with CurveOffsetCornerStyle.None
var offsetResult2 = curve.Offset(Plane.WorldXY, -360, 0.01, CurveOffsetCornerStyle.Sharp); //PolyCurve result with CurveOffsetCornerStyle.None
doc.Objects.AddCurve(offsetResult1[0]);
doc.Objects.AddCurve(offsetResult2[0]);
doc.Views.Redraw();
return Result.Success;
}