Message 1 of 2
Not applicable
01-19-2019
01:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to make simple app to make holes for shelfs, so the easy way would be Hole feature, rather then sketch and extrude.
Idea is to select face for holes, edge from front and top and also the edge on the back.
Thank you
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
holeDepth = adsk.core.ValueInput.createByReal(1.2)
app = adsk.core.Application.get()
ui = app.userInterface
design = app.activeProduct
rootComp = adsk.fusion.Component.cast(design.rootComponent)
sketches = rootComp.sketches
extrudes = rootComp.features.extrudeFeatures
faceSel = ui.selectEntity('Select a face', 'Faces')
if faceSel:
selectedFace = adsk.fusion.BRepFace.cast(faceSel.entity)
Edge1Sel = ui.selectEntity('Select a edge', 'LinearEdges')
selEdge = adsk.fusion.BRepEdge.cast(Edge1Sel.entity)
holes = rootComp.features.holeFeatures
holeinput = holes.createSimpleInput(holeDepth)
# ? holeinput.setPositionOnEdge(selectedFace,selEdge,1)
holeinput.setDistanceExtent(holeDepth)
hole = holes.add(holeinput)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.