BUG? - CurveOffsetCornerStyle.None produces bad result

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.
    image

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;
		}

Hi @jeffoulet,

I’m assuming by specifying CurveOffsetCornerStyle.None, each curve span is offset, which is why a polycurve is returned. But I’d need to dig further. I can see that OffsetMultiple produces the same result as Curve.Offset.

I also see that the Offset command does not give you Corner=None option. I’m not sure why they differ.

I’ve logged the wish for a loose option.

https://mcneel.myjetbrains.com/youtrack/issue/RH-57413

To to "both sides, just invert the distance value and offset again.

The cap option is not part of the offset calculation. But it’s is easy to do. Flat is just a line segment connecting the two curve. Round is just a start, direction, end arc. Let me know if you need a sample of this

– Dale

I made a python script for this, maybe it helps:

RH-57413 is fixed in the latest WIP