Message 1 of 6
Adding new workspace not working

Not applicable
12-25-2019
08:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to add a new workspace but it does not seem to work.
What am I doing wrong? No error but no new workspace appears in the list.
import adsk.core, adsk.fusion, adsk.cam, traceback import random def run(context): try: app = adsk.core.Application.get() ui = app.userInterface cmdDefinitions = ui.commandDefinitions anotherExtrudeCmd = cmdDefinitions.itemById('Extrude') #Random ID so I dont have to remove old before adding new ID1 = str(random.randint(0, 9999999999)) ID2 = str(random.randint(0, 9999999999)) ID3 = str(random.randint(0, 9999999999)) nWorkspace = ui.workspaces.add("DesignProductType", ID1, "New Workspace", "") nTabs = nWorkspace.toolbarTabs nTab = nTabs.add(ID2, "New Tab") nPannels = nTab.toolbarPanels nPannel = nPannels.add(ID3, "New Pannel") nPannel.isVisible = True nControlls = nPannel.controls nControll = nControlls.addCommand(anotherExtrudeCmd) nControll.isVisible = True nControll.isPromoted = True nControll.isPromotedByDefault = True except: if ui: print(traceback.format_exc())