In UI Preview mode, running an add-in that adds a toolbar panel to Fusion 360, then stopping the add-in, then running it again creates an empty space in toolbar. Repeating the previous steps adds more and more empty spaces to the toolbar.
For reproducing the bug, please follow the following steps:
1- Enable UI Preview mode (using Preferences > Preview > UI Preview option)
2- Create an add-in using the following code (borrowed from @liujac code here)
3- Run the add-in
4- Stop the add-in
5- Run the add-in again
import adsk.core, adsk.fusion, adsk.cam, traceback tbPanel = None def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface workSpace = ui.workspaces.itemById('FusionSolidEnvironment') tbPanels = workSpace.toolbarPanels global tbPanel tbPanel = tbPanels.itemById('NewPanel') if tbPanel: tbPanel.deleteMe() tbPanel = tbPanels.add('NewPanel', 'New Panel', 'SelectPanel', False) # Empty panel can't be displayed. Add a command to the panel cmdDef = ui.commandDefinitions.itemById('NewCommand') if cmdDef: cmdDef.deleteMe() cmdDef = ui.commandDefinitions.addButtonDefinition('NewCommand', 'New Command', 'Demo for new command') tbPanel.controls.addCommand(cmdDef) ui.messageBox('Hello addin') 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 if tbPanel: tbPanel.deleteMe() ui.messageBox('Stop addin') except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.
Solved by keqingsong. Go to Solution.
We have a fix for this - it'll be in the next update!
Can't find what you're looking for? Ask the community or share your knowledge.