Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Not sure if I'm using the right terminology but this is what I want to do:
This is what I'm doing right now:
def run(context):
try:
app = adsk.core.Application.get()
ui = app.userInterface
# create panel
workSpace = ui.workspaces.itemById('FusionSolidEnvironment')
toolbarPanels = workSpace.toolbarPanels
# get toolbarPanel
toolbarPanel = toolbarPanels.itemById(UI_TOOLBAR_PANEL_ID)
if not toolbarPanel:
toolbarPanel = toolbarPanels.add(UI_TOOLBAR_PANEL_ID, UI_TOOLBAR_PANEL_NAME, 'SelectPanel', False)
# create command definition
commanDefinition = ui.commandDefinitions.itemById(UI_EXPORT_DESIGN_COMMAND_ID)
if not commanDefinition:
commanDefinition = ui.commandDefinitions.addButtonDefinition(UI_EXPORT_DESIGN_COMMAND_ID, UI_EXPORT_DESIGN_NAME, UI_EXPORT_DESIGN_TOOLTIP, 'resources/exportIt_designs_icons')
# Adds the commandDefinition to the toolbar panel
cmdControl = toolbarPanel.controls.addCommand(commanDefinition)
cmdControl.isPromotedByDefault = True
# add event handler
onCommandCreated = ExportDesignCommandCreatedHandler()
commanDefinition.commandCreated.add(onCommandCreated)
_handlers.append(onCommandCreated)
except:
logger.error(traceback.format_exc())
Any hint what's wrong in my code?
Solved! Go to Solution.