Message 1 of 5
Bug? UserInterface.selectEntity should return None but fails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
According to the documentation, the UserInterface.selectEntity method returns None if the selection is aborted.
I guess that the selection is aborted by pressing the Esc key. But in that case, the method returns an error message:
Here is a code to reproduce the issue:
import adsk.core, adsk.fusion, adsk.cam, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface design = app.activeProduct # Get the root component of the active design. rootComp = design.rootComponent # Create a new sketch on the xy plane. sketches = rootComp.sketches xyPlane = rootComp.xYConstructionPlane sketch = sketches.add(xyPlane) # Draw some circles. circles = sketch.sketchCurves.sketchCircles circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 2) circle2 = circles.addByCenterRadius(adsk.core.Point3D.create(8, 3, 0), 3) # Add a circle at the center of one of the existing circles. circle3 = circles.addByCenterRadius(circle2.centerSketchPoint, 4) selection = ui.selectEntity('Select a profile', 'Profiles') if not selection: ui.messageBox('No profile selected') else: ui.messageBox('One profile selected') except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Thanks.
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file