where to find specific Id in itemById

where to find specific Id in itemById

Anonymous
Not applicable
913 Views
3 Replies
Message 1 of 4

where to find specific Id in itemById

Anonymous
Not applicable

Hi F360 users,

I am new to fusion 360 and learning the fusion 360 API. The sample code for Add-In provided in the documentation here accesses the ADD-IN panel in the workspace by using,

addInsPanel = ui.allToolbarPanels.itemById('SolidScriptsAddinsPanel')

 

Now I want to know where to find the Ids of different panels in the fusion 360 user interface? As I did not find the reference of 'SolidScriptsAddinsPanel' id anywhere else.

0 Likes
Accepted solutions (1)
914 Views
3 Replies
Replies (3)
Message 2 of 4

JeromeBriot
Mentor
Mentor
Accepted solution

Hello,

 

Iterate through the collection and write the info into a text file:

 

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

import platform
import os

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

        if platform.system() == 'Windows':
            filename = os.path.join(os.getenv('USERPROFILE'), 'Desktop', 'panelsInfo.txt')
        else:
            filename = os.path.join(os.path.expanduser('~'), 'Desktop', 'panelsInfo.txt')

        with open(filename, 'w') as f:
            for tb in ui.allToolbarPanels:
                f.write('{} {}\n'.format(tb.name, tb.id))
                ctrls = ui.allToolbarPanels.itemById(tb.id).controls
                for ctrl in ctrls:
                    f.write('\t{}\n'.format(ctrl.id))

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

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

@JeromeBriot Thanks for your reply.

 

I have one more query. Can I trigger the action of any panel on fusion 360 using API?

0 Likes
Message 4 of 4

NA_Currently
Observer
Observer

It would be nice if Autodesk provided documentation for this, rather than making it a code development project. They also have removed the "remove from panel" option, making it difficult to optimize your workflow.  Today, they popped up an "automate" button right in the middle of the design space, with no indication how to remove this, or at least shift it over to completely one side or the other, out of the way...