Message 1 of 3
Cannot add a new workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
For my addin, I've been trying to get the creation of a new workspace to work with no success.
According to my testing, the workspace does get activated but the only thing I see is the default FusionSolidEnvironment workspace and anything I try adding (or removing) to the new workspace doesn't show.
Am I missing something ?
ui = None
app : adsk.core.Application = adsk.core.Application.get()
if app:
ui = app.userInterface
def run(context):
try:
ui = app.userInterface
allWorkspaces = ui.workspaces
designWorkspace = allWorkspaces.itemById('FusionSolidEnvironment')
allDesignTabs = designWorkspace.toolbarTabs
allToolbarPanels = designWorkspace.toolbarPanels
designWorkspace.activate()
test = ui.workspaces.itemById('testWorkspace')
if test:
test.deleteMe()
test = ui.workspaces.add(designWorkspace.productType, 'testWorkspace', 'testName', designWorkspace.resourceFolder)
if test:
test.activate()
toolbarTabs = test.toolbarTabs
newTab = toolbarTabs.itemById('testTab')
if newTab:
newTab.deleteMe()
newTab = toolbarTabs.add('testTab', 'testTab')
newPanel = newTab.toolbarPanels.itemById('testPanel')
if newPanel:
newPanel.deleteMe()
newPanel: adsk.core.ToolbarPanel = newTab.toolbarPanels.add('testPanel', 'testPanel')
newPanel.controls.addCommand(ui.commandDefinitions.itemById('Extrude'))
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))