Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

what is the ID for the simulation workspace?

lsRDZZQ
Participant

what is the ID for the simulation workspace?

lsRDZZQ
Participant
Participant

Hi, I want to add a button to the simulation workspace, can not find the id for that,

 

is it FusionModelingEnvironment? thanks

0 Likes
Reply
557 Views
4 Replies
Replies (4)

marshaltu
Autodesk
Autodesk

Hello,

 

It should be 'SimulationEnvironment'. You could iterate all workspaces by the following codes:

 

#Author-
#Description-

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        for workspace in ui.workspaces:
            ui.messageBox(workspace.id)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes

lsRDZZQ
Participant
Participant

Thanks, I tried it, now i can get the correct workspace object. but when i try to add a panel to Simulation workspace, it always return null. But the same code i can add a panel to solid workspace without any problems.

 

auto workspace = workspaces->itemById("SimulationEnviroment");
auto toolbarPanels = workspace->toolbarPanels();
auto panel = toolbarPanels->add("NewPanelID", "NewPanel"); 
auto panelCtrl = panel->controls();

If i change the id to "FusionSolidEnviroment", toolbarPanels.add can success without any problems. Please help me out. thanks

0 Likes

marshaltu
Autodesk
Autodesk

Hello,

 

Please try to get workspaces by productType and then it should work.

 

This was our mistake how to design the API. One workspace might belong to multiple products and multiple workspaces might associate to one product. We need users' input which workspace of product they want to add toolbar item into. Unfortunately we cannot do cleanup for old design to keep backward compatibility. 

 

We will do improvement to prompt users with meaningful message once users run into the kind of issue in future releases.

 

Thanks,

Marshal 

 

auto workspaces = ui->workspacesByProductType("SimStudiesProductType");
auto workspace = workspaces->itemById("SimulationEnviroment");
auto toolbarPanels = workspace->toolbarPanels();
auto panel = toolbarPanels->add("NewPanelID", "NewPanel"); 
auto panelCtrl = panel->controls();


Marshal Tu
Fusion Developer
>
0 Likes

david.lopez7E84R
Explorer
Explorer

What would this look like for PANEL_ID’s?

0 Likes