Curve.Offset makes Rhino7 to hang forever

Hi everybody!
My RhinoCommon plugin needs to create an offset curve of another curve.
The code is really simple:

inputCurve.Offset(Plane.WorldXY, offsetAmount, offsetTolerance, cornersStyle);

Where offsetAmount = 20.0
OffsetTolerance = 0.1
CornerStyle = Round

When i execute that line of code code on a particular curve (attached to this post) the code execution seems to hang forever (even if I’m using the Visual Studio debugger).
It doesn’t seem to work even if I try do create the offset curve using Rhino interface (see image)


In the image you can see all the offset command parameters i’m using… But it seems to fail also with different ones.

OffsetError.3dm (29.6 KB)

My Rhino version is 7.10.
Can you help me please?
Thanks|

Hi @software_comas,

The artifact you see when running the command is to let you know that the corner corner condition you chose isn’t going to work. If you complete the command you’ll see that the curve comes to a point in that area.

Also, here is the result I got using the simple Python script below, and there was no noticeable “hang” or delay:

iimport Rhino
import scriptcontext as sc

def test_offset():
    filter = Rhino.DocObjects.ObjectType.Curve
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select curve", False, filter)
    if rc != Rhino.Commands.Result.Success: return
    
    crv = objref.Curve()
    if not crv: return
    
    rc, point = Rhino.Input.RhinoGet.GetPoint("Offset point", False)
    if rc != Rhino.Commands.Result.Success: return
    
    plane = Rhino.Geometry.Plane.WorldXY
    plane.Origin = point
    dist = 20.0
    tol = sc.doc.ModelAbsoluteTolerance
    corner = Rhino.Geometry.CurveOffsetCornerStyle.Round
    
    offsets = crv.Offset(plane, dist, tol, corner)
    if offsets:
        for c in offsets:
            sc.doc.Objects.AddCurve(c)
    sc.doc.Views.Redraw()
    
test_offset()

– Dale

Hi @dale!
Thanks for your reply.
I’m sorry to say that I’m not able to complete the command using Rhino offset tool, or using a RhinoCommon command.
Rhino hangs in both situations.
Well… It hanged yesterday!
Today everything seems to work fine!
Don’t know what to say…