Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug Report: negative offset to Sketch.offset sometimes results in incorrect results

3 REPLIES 3
Reply
Message 1 of 4
JesusFreke
212 Views, 3 Replies

Bug Report: negative offset to Sketch.offset sometimes results in incorrect results

Depending on the exact geometry, if you try to pass a negative offset to Sketch.offset, sometimes the resulting offset curve will be offset by a slightly less amount than requested.

 

JesusFreke_0-1622613868102.png

 

As you can see, the offset constraint is correctly shown as 1.00, but the actual distance is .894

 

Code:

def run(_):
    app = adsk.core.Application.get()
    design = adsk.fusion.Design.cast(app.activeProduct)
    root = design.rootComponent

    occurrence = root.occurrences.addNewComponent(adsk.core.Matrix3D.create())

    sketch = occurrence.component.sketches.add(root.xYConstructionPlane)

    sketch_line = sketch.sketchCurves.sketchLines.addByTwoPoints(
        adsk.core.Point3D.create(0, 0, 0),
        adsk.core.Point3D.create(0, .25, 0))

    sketch_lines = adsk.core.ObjectCollection.create()
    sketch_lines.add(sketch_line)

    sketch.offset(
        sketch_lines,
        sketch.modelToSketchSpace(adsk.core.Point3D.create(.5, .5, 0)),
        -.1)

 

In the meantime, a workaround is to always use a positive offset, and use a different reference point depending on which way you want to offset.

 

One workaround is to uuse a different reference point, 

 

3 REPLIES 3
Message 2 of 4
nnikbin
in reply to: JesusFreke

Hi @JesusFreke 

Maybe it is not a bug and I guess it is by design. In your example the directionPoint is out of perpendicular sweep area of the line. So it seems the offset algorithm considers an effect factor equal to cos(A) for the offset.

 

If the direction point is in  perpendicular sweep area of the line, the effect factor will be 1 and the distance will be 1.0.

 

47.png

Message 3 of 4
JesusFreke
in reply to: JesusFreke

Ah, that's an interesting observation. But I would I would still tend to say this likely isn't intended behavior.

1. That behavior isn't documented

2. When using a positive offset, the curve is always (as far as I've seen) offset the specified amount, regardless of the location of the reference point

3. The geometric constraint shows an offset of 1.0

 

Message 4 of 4
nnikbin
in reply to: JesusFreke

You are right. So it seems it is probably a bug or at least inconsistent behavior. It is interesting that in your sample, for positive offset the constraint shows an angled direction while for negative offset, it shows a horizontal direction.  Somehow contrary to their results.

 

48.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report