There are two things to do, if you want to create a button in the toolbar like the image you posted.
1. You will need to add a Panel to the toolbar
Here is a post from the forum showing you how to add a new Panel to the toolbar in the Model environment
app = adsk.core.Application.get() ui = app.userInterface workSpace = ui.workspaces.itemById('FusionSolidEnvironment') tbPanels = workSpace.toolbarPanels tbPanel = tbPanels.itemById('NewPanel') if tbPanel: tbPanel.deleteMe() tbPanel = tbPanels.add('NewPanel', 'New Panel', 'SelectPanel', False)
2. You will need to add a control (Button) to the panel and a command (Button attributes) to the control
The second part of the run method from the above mentioned post shows how to do so
cmdDef = ui.commandDefinitions.itemById('NewCommand') if cmdDef: cmdDef.deleteMe() cmdDef = ui.commandDefinitions.addButtonDefinition('NewCommand', 'Dimensions', 'Demo for new command', './resources') tbPanel.controls.addCommand(cmdDef)
Two other things to mention
Hope this helps.
- Erik