- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can I get an offset curve from an brepLoop? I've tried it that way:
import adsk.core, adsk.fusion, traceback, math
#app = adsk.core.Application.cast(None)
#ui = adsk.core.UserInterface.cast(None)
def run(context):
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Select a face
faceSel = ui.selectEntity('Select a face', 'Faces')
if faceSel:
face = adsk.fusion.BRepFace.cast(faceSel.entity)
des = adsk.fusion.Design.cast(app.activeProduct)
root = des.rootComponent
distance = adsk.core.ValueInput.createByString('2 mm')
# Create a sketch on the selected face
sketch=root.sketches.add(face)
# Get the outer loop of the selected face
brepLoops = face.loops
outerLoop = brepLoops.item(0)
# Create the offset.
dirPoint = adsk.core.Point3D.create(0, -0.5, 0)
sketch.offset(outerLoop, dirPoint, distance)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
I'm sure there are some steps missing...
Solved! Go to Solution.