Get Sketch Plane - Python Modification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anybody help?
I have the following Python script. You have to select the sketch "manually" to get its sketch plane.
import adsk.core, adsk.fusion, adsk.cam, traceback, csv, subprocess
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
sel = Sel('select sketch','Sketches')
if sel is None: return
skt = adsk.fusion.Sketch.cast(sel.entity)
refplane = skt.referencePlane #This
if refplane.classType() == 'adsk::fusion::BRepFace':
SketchPlane = '{} face'.format(refplane.body.name)
else:
SketchPlane = refplane.name
ui.messageBox('Reference Plane is\n' + SketchPlane )
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def Sel(msg, selFilter):
app = adsk.core.Application.get()
ui = app.userInterface
try:
return ui.selectEntity(msg, selFilter)
except:
return None
Can any body modify, for testing purposes only, the script so that it always, automatically, selects Sketch1?
Many thanks in advance!
Darren