Message 1 of 4
Offset a projected sketch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to offset a sketch of a projected spline
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context) :
ui = adsk.core.UserInterface.cast(None)
try:
app = adsk.core.Application.get()
ui = app.userInterface
design = adsk.fusion.Design.cast(app.activeProduct)
root= design.rootComponent
targetBody: adsk.fusion.BRepBodies= root.bRepBodies[4]
skt: adsk.fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
skt.project(targetBody)
SketchSel = ui.selectEntity('Select sketch to offset', 'Sketches')
if SketchSel:
sketchSel = SketchSel.entity
sketch = adsk.fusion.Sketch.cast(sketchSel)
points=adsk.core.ObjectCollection.create()
points.add(sketch.sketchPoints)
spline = sketch.sketchCurves.sketchFittedSplines.add(points)
curve = sketch.findConnectedCurves(spline)
dirPoint = adsk.core.Point3D.create(6, 0, 0)
offsetCurves = sketch.offset(curve, dirPoint, -1)