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.
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,
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.
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
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.
Can't find what you're looking for? Ask the community or share your knowledge.