+ Reply to Thread
Results 1 to 8 of 8

Thread: Trouble Offsetting Curves

  1. #1

    Trouble Offsetting Curves

    Hi Guys,

    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:

    Code:
    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)
    Usually curves[0] will be the correct offsetCurve.

    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
    Conrad

  2. #2
    Problem seems to be solved by raising the tolerance.

    I included a while loop to increase the tolerance until a clean curve with a certain length is returned.

    Conrad

  3. #3
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    285
    Offsetting is notoriously unreliable in Rhino. Manually, it can also depend a lot on the pick point, and the scripted version is no exception. Some curves will offset into two or more curves no matter what.

    --Mitch

  4. #4
    Unfortunately I have to agree. The result is dependent on tolerance and pick point.

    Actually you can determine a lot of the curve parameters during the runtime.

    I could choose pickpoint and tolerance based on the curve and the offset distance and direction, but I don't know set these parameters to make it the most reliable.

    Best regards
    Conrad

  5. #5
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,463
    Blog Entries
    19
    If you have sample geometry that isn't working correctly, I would be happy to pass it on the the developer who wrote the offset code

  6. #6
    Dear Steve,

    I come back to this issue, because it still haunts me in my projects. I built a rather large projects around offsetting , actually mostly insetting planar curves parallel to the xy-Plane.

    Please have a look at the attached file and the associated GH-file.
    (It is not Python at the moment, but it illustrates the problem I am dealing with in Rhino-Python.)

    If you increase the Offset-Distance beyond 7.5 mm (cornerstyle = sharp), the offset curve turns into an array of curves, some of them making no sense to me.

    The manual Rhino command yields the same results, so the problem is not in Rhino-Python itself.

    Is this the intended behaviour? It makes it very hard to program bulletproof solutions, because you have to cover these unexpected solutions or filter the unwanted curves.

    Best regards
    Conrad
    Attached Files

  7. #7
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,463
    Blog Entries
    19
    I would call this a bug. I'll put the file on the developer's list who is in charge of the offset command.
    Thanks,
    -Steve

  8. #8
    Thanks!

    For the record: My current workaround is dynamically changing the "CurveCornerStyle" and tolerance to whatever produces a single curve of a plausible length ...

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts