Variable Curve.OffsetOnSurface

Documentation states that since Rhino 5 there is an overload method to offset a crv on a surface, by variable distances:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_OffsetOnSurface_2.htm

@piac , @dale , @stevebaer Is it possible to provide a small sample code? C#/VB/python?

What I am struggling to understand is ‘curveParameters’ array input.

Attached is an example surface with its border crv.
srf_example.3dm (31.9 KB)

As a workaround I can use the basic method and offset each crv’s segment individually, then split it with other segment offsets in order to get the final offset of the initial crv. But I am interested if this can be done instead with the upper overload.

Thank you in advance for any help.

Hi @djordje,

I’ve attached a simple example that demonstrates the method you’ve referenced.

test_offset_crv_on_srf.py (1.2 KB)

In the case of your model, there the curve to offset has kinks (corners), I doubt this method to provide you with the results you want. I believe the approach you are already taking is the correct one.

– Dale

1 Like

Thank you @dale .
I believe your advice that this may not be a good approach due to kinks.
Still I wanted to see at least what is the result. However, when I run the upper .py file I get ‘None’ returned from ‘curve.OffsetOnSurface’.
I am running on Rhino 6. Do you get the offset curves on Rhino 7?

Hi @dale,

i am sorry but i’ve found a case where offsetting a curve on surface crashes Rhino 6 (6.34.21034.7001, 03.02.2021). I’ve send a CrashDump. Please try your script with below example to replicate the crash:

OffsetCrvOnSurface.3dm (88.2 KB)

I guess the problem is that the curve goes over a closed surface seam ?

_
c.

1 Like

Yep - I see that.

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

– Dale

1 Like

Hi @clement ,
Do you get any offset curves when you run @dale 's script on .3dm file from the initial post of this topic?
I don’t. If you do, can you post a screenshot please? Thank you in advance.

Hi @djordje, no. Only if i flip the curve direction, the result is unexpected, it goes infinitely outside the surface.

I get another infinite extension if i don’t flip the curve and negate the offset distances. (Testing with V6).

_
c.

1 Like

Thank you for the detailed testing @clement
@dale can I please see at least a screenshot of the offset curves which you get when running the .py file on the initial .3dm model?
Do you have an idea why ‘curve.OffsetOnSurface’ returns None for that .3dm model on Rhino 6?

Hey @djordje,

Attached was my cheap test geometry.

test_offset_crv_on_srf.3dm (27.2 KB)

– Dale

Thank you @dale.
You ran your .py file and this .3dm on Rhino 7?
On Rhino 6 ‘curve.OffsetOnSurface’ returns None with the .3md file you attached.

Really strange, i get a result with Dale’s example using 6 SR34
(6.34.21034.7001, 03.02.2021)

_
c.

1 Like

Thank you for the testing and the video @clement .
It does indeed work the same on my Rhino 6.
I guess I misunderstood the whole concept of Curve.OffsetOnSurface. I was hopping to offset the 4 edge crvs of the surface for variable distances, but on upper initial curved surface. It seems like Curve.OffsetOnSurface was not made for that. To achieve something like this:
image

I will then come back to individual way of offsetting each edge crvs and splitting the results.
Thank you once again for the help, both of you.

RH-63131 is fixed in the latest Rhino 7 Service Release