A new Fusion 360 toolbar UI is becoming official soon, including changes to the existing API. To ensure that your add-ins are still compatible, we highly encourage you to update your add-in using the new API: https://docs.google.com/document/d/174ISmaXs-60JRtn8bt4Sbr6Z3jqzkyoSizVD9YwChOQ/edit?usp=sharing
For convenience I'm also pasting here the content:
Tabbed Toolbar API
UserInterface class changes
http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-52303e26-c1c2-4a1c-8c1a-a3c199e6db63
app = adsk.core.Application.get()
ui = app.userInterface
Indicates if Fusion 360 is running with in the old toolbar or new toolbar:
# bool isTabbedToolbar { get; }
runningTabbedToolbar = ui.isTabbedToolbar
Gets all of the toolbar tabs. This returns all of the tabs available, regardless of which workspace or product they're associated with.
# ToolbarTabList allToolbarTabs { get; }
Similar example: see commandDefinitions, like: ui.commandDefinitions
allToolbarTabsList = ui.allToolbarTabs
this gets all of the toolbar tabs associated with the specified product. The full list of available products can be obtained by using the Application.supportedProductTypes property.
# ToolbarTabList toolbarTabsByProductType(string productType);
supportedProductTypesList = app.supportedProductTypes
print(supportProductTypesList)
# Example output: ('CAMProductType', 'AnimationProductType', 'DesignProductType', 'FusionDrawingProductType', 'SimStudiesProductType')
tabsListForProduct = ui.toolbarTabsByProductType('DesignProductType')
New! ToolbarTabList class
This is a collection of ToolbarTab objects
Returns the specified tab using an index into the collection.
# ToolbarTab item(uint index);
Returns the ToolbarTab of the specified ID.
# ToolbarTab itemById(string id);
Gets the number of toolbar tabs in the collection.
# uint count { get; }
Try to get the Solid tab:
solidTab = allToolbarTabsList.itemById('SolidTab')
New! ToolbarTab class
Gets ID of tab:
# string id { get; }
Get position of this tab within its toolbar:
# uint index { get; }
Gets whether this tab is currently being displayed in the user interface
# bool isVisible { get; }
Gets the name of the tab as seen in the user interface.
# string name { get; }
Gets the collection containing the panels associated with this tab.
It's through this collection that you can add new toolbar panels.
# ToolbarTabPanels toolbarPanels { get; }
Gets the parent UserInterface object.
# UserInterface parentUserInterface { get; }
# Returns the name of the product this toolbar tab is associated with.
# string productType { get; }
# Make sure that it isn't null
if solidTab:
# Found solidTab! Ok to use it now!
isSolidTabVisible = solidTab.isVisible
allSolidTabPanels = solidTab.toolbarPanels
New! ToolbarTabPanels class
Collection of ToolbarPanel objects (ToolbarPanel is existing class)
Unlike ToolbarPanels, ToolbarTabPanels class lets you position the panel in a specific tab in relation to other panels in the toolbar.
Creates a new ToolbarPanel. The panel is initially empty.
# ToolbarPanel add(string id, string name, [Optional] string positionID = "", [Optional] bool isBefore = true);
Returns the specified toolbar panel using an index into the collection.
# ToolbarPanel item(uint index);
Returns the ToolbarPanel at the specified ID.
ToolbarPanel itemById(string id);
Gets the number of panels.
# uint count { get; }
Add a new panel to a particular tab:
fancyAddinToolbarPanel = allSolidTabPanels.add('JenCompanyAddin', 'DoImportantFusionThingPanel')
ToolbarPanel class (existing class, but 1 new method)
http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-0ca48ac9-da95-4623-bf87-150f3729717a
# string id { get; }
# uint index { get; }
# bool isVisible { get; }
# string name { get; }
# bool deleteMe();
# ToolbarControls controls { get; }
# UserInterface parentUserInterface { get; }
# ToolbarControlList promotedControls { get; }
# ObjectCollection relatedWorkspaces { get; set; }
# productType { get; }
New method - Gets the position this panel is in within the toolbar tab.
# uint indexWithinTab(string tabId);
Add a control to the initially empty new toolbar panel:
ToolbarControls class: https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-df24e158-40e0-4aed-9990-97c470935dbb
fancyAddinToolbarPanelControls = fancyAddinToolbarPanel.controls
Assume JenFancyCommmandDef created already....
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-1ed0cfb5-2ad4-4285-9eec-484ef19f2729
doSomethingAmazingCmdControl = fancyAddinToolbarPanelControls.addCommand(JenFancyCommmandDef, '', False)
Workspace class (existing class, but 1 new method)
Gets the collection containing the tabs associated with this workspace.
# ToolbarTabs toolbarTabs { get; }
Get a list of all workspaces:
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-75ac7274-735c-4a61-af57-1d837c4df217
workspacesList = ui.workspaces
print (workspacesList.count)
The above example prints 29 total workspaces in Fusion.
Note from Jennifer: With 29 workspaces that don't match up with the new Tabbed Toolbar
"Workspaces" as shown in the Workspace Switcher, I'm not sure how valuable
workspaces will be for new API writers and tabbed toolbar?
Get a single workspace:
oneWorkspace = workspacesList.itemById('FusionModelingEnvironment')
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-33f9ed37-e5c7-4153-ba85-c3254a199dd1
# Gets the collection containing the tabs associated with this workspace.
# ToolbarTabs toolbarTabs { get; }
modelingEnvToolbarTabs = oneWorkspace.toolbarTabs
New! ToolbarTabs class
Collection of ToolbarTab objects
Returns the specified toolbar tab using an index into the collection.
# ToolbarTab item(uint index);
Returns the ToolbarTab at the specified ID.
# ToolbarTab itemById(string id);
# Gets the number of ToolbarTabs.
# uint count { get; }
In the August Update (coming around mid August), we will be making the new toolbar UI the default toolbar for Fusion 360. Users will have the option to revert back to the old toolbar, however this option will only be available for a limited period of time. The current plan is to completely transition over to the new toolbar UI by the September Update.
If you haven’t tried out the new toolbar UI yet, you can turn it on by going to the Preferences > Preview section and checking the UI Preview option.
Here is a video of the top 5 changes to look for when using the new toolbar UI.
The commands of existing add-ins will be redirected to the most appropriate place, but it's not always possible. In that case the command buttons will be placed in the Tools tab as a default location under the new toolbar UI.
It's better to use the new API's to make sure your command button goes exactly where you want it 😀