- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Here is a example:
import adsk.core, adsk.fusion, adsk.cam, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface cmdDefs = ui.commandDefinitions testButton = cmdDefs.addButtonDefinition('TestButton', 'TestButton', 'TestButton', 'resources') makePanel = ui.allToolbarPanels.itemById('SolidMakePanel') makePanel.controls.addSeparator() dropdown = makePanel.controls.addDropDown('TestDrodown', 'resources', 'TestDrodown', '', True) button = dropdown.controls.addCommand(testButton) button.isPromoted = True except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) def stop(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface cmdDefs = ui.commandDefinitions cmdDef = cmdDefs.itemById('TestButton') if cmdDef: cmdDef.deleteMe() makePanel = ui.allToolbarPanels.itemById('SolidMakePanel') cntrls = makePanel.controls cntrl = cntrls.itemById('TestButton') if cntrl: cntrl.isPromoted = False cntrl.deleteMe() cntrl = cntrls.itemById('TestDrodown') if cntrl: cntrl.deleteMe() except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
When the add-in is stopped, all controls are removed except the promoted button.
Thank you.
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
Solved! Go to Solution.