Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding new workspace not working

5 REPLIES 5
Reply
Message 1 of 6
edidos
347 Views, 5 Replies

Adding new workspace not working

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())
5 REPLIES 5
Message 2 of 6
Jellej
in reply to: edidos

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.

Message 3 of 6
edidos
in reply to: Jellej

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.

Message 4 of 6
Jellej
in reply to: edidos

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.

Message 5 of 6
BrianEkins
in reply to: edidos

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
Message 6 of 6
Jellej
in reply to: BrianEkins

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report