Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Adding new workspace not working

Anonymous
626 Views
5 Replies
Message 1 of 6

Adding new workspace not working

Anonymous
Not applicable

I am trying to add a new workspace but it does not seem to work.

What am I doing wrong? No error but no new workspace appears in the list.

 

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

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

        cmdDefinitions = ui.commandDefinitions
        anotherExtrudeCmd = cmdDefinitions.itemById('Extrude')

        #Random ID so I dont have to remove old before adding new
        ID1 = str(random.randint(0, 9999999999))
        ID2 = str(random.randint(0, 9999999999))
        ID3 = str(random.randint(0, 9999999999))


        nWorkspace = ui.workspaces.add("DesignProductType", ID1, "New Workspace", "")


        nTabs = nWorkspace.toolbarTabs

        nTab = nTabs.add(ID2, "New Tab")
        
        nPannels = nTab.toolbarPanels

        nPannel = nPannels.add(ID3, "New Pannel")

        nPannel.isVisible = True

        nControlls = nPannel.controls

        nControll = nControlls.addCommand(anotherExtrudeCmd)

        nControll.isVisible = True
        nControll.isPromoted = True
        nControll.isPromotedByDefault = True
        

    except:
        if ui:
            print(traceback.format_exc())
0 Likes
627 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Got the exact same problem. The workspace is being added (as it says that a workspace with the same ID already exist when running the add-in the second time) but not appearing in the environment list.

2 Likes
Message 3 of 6

Anonymous
Not applicable

The only Add-In I know of that is adding a new workspace is joinerCAD, but its Windows only so I cant download to see how they are doing it.    

It might be worth having a look If you have the right OS.

2 Likes
Message 4 of 6

Anonymous
Not applicable

Thank you for the suggestion!

 

Unfortunetaly, JoinerCAD doesn't add a new workspace, but adds a new toolbar instead. Apart from that, their source script is locked, so you simply can't view their code.

 

Thanks anyway! Much apreciated.

0 Likes
Message 5 of 6

BrianEkins
Mentor
Mentor

I believe with the change to the new UI, some changes were made to workspaces and the API hasn't been updated to fully support customization of the new UI.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
1 Like
Message 6 of 6

Anonymous
Not applicable

That would be a little disappointing, but at least it could be an explanation. I've read another post that was very recent with this issue. The documentation that I found of cases where it did function, are a little older.

0 Likes