How do I get panel name strings?

How do I get panel name strings?

obatake5TC3R
Advocate Advocate
1,266 Views
2 Replies
Message 1 of 3

How do I get panel name strings?

obatake5TC3R
Advocate
Advocate

I am testing  add-in programing. So I saw 'Super Gear' cpp sample.

line 739

 Ptr<ToolbarPanel> createPanel = ui->allToolbarPanels()->itemById("SolidCreatePanel");

and line 743 (Created command button.)

Ptr<CommandControl> gearButton = createPanel->controls()->addCommand(cmdDef);

I would like to know panel names. (ui->allToolbarPanels()->itemById("****panel name");)

How do I know panel name?

If there are sample programs, tell me.

1,267 Views
2 Replies
Replies (2)
Message 2 of 3

JeromeBriot
Mentor
Mentor

Hello,

 

here is a Python script that you can easily translate in C++:

 

#Author-Jerome Briot
#Description-

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

def run(context):
    ui = None
    try:

        app = adsk.core.Application.get()
        ui  = app.userInterface

        for i in range(ui.allToolbarPanels.count):
            if ui.allToolbarPanels.item(i).isVisible == True:
                print(ui.allToolbarPanels.item(i).id)

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

It returns (for example):

CAMJobPanel
CAM2DPanel
CAM3DPanel
CAMDrillingPanel
CAMMultiAxisPanel
CAMTurningPanel
CAMWLPCPanel
CAMActionPanel
CAMInspectPanel
CAMManagePanel
VisualizationPanel
CAMScriptsAddinsPanel
SelectPanel
3DStoryboardPanel
3DComponentPanel
AnnotationPanel
PublisherViewPanel
PublishVideoPanel
DebugDialog
ForDeletionPanel
SketchPanel
SolidCreatePanel
SolidModifyPanel
AssembleJointsPanel
ConstructionPanel
InspectPanel
InsertPanel
SolidMakePanel
SolidScriptsAddinsPanel
SelectPanel
FusionDocumentationEnvironment
ViewsPanel
ModifyPanel
GeometryPanel
DimensionsPanel
TextPanel
SymbolsPanel
BillOfMaterialsPanel
OutputPanel
StudyPanel
MaterialsPanel
ConstraintsPanel
LoadsPanel
ContactsPanel
ViewsPanel
SolvePanel
ManagePanel
ResultsPanel
InspectPanel
SynchronizePanel
ResultsAnimatePanel
ResultsOptionsPanel
PostMeshPanel
CompareLayoutsPanel
SelectPanel
DebugPanel

 Note that a more Pythonic version would be:

#Author-Jerome Briot
#Description-

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

def run(context):
    ui = None
    try:

        app = adsk.core.Application.get()
        ui  = app.userInterface

        for TbP in ui.allToolbarPanels:
            if TbP.isVisible == True:
                print("{}".format(TbP.id))

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

 

Message 3 of 3

ekinsb
Alumni
Alumni

Jerome's program is good.  There's also a sample program in the Fusion 360 API help that dumps out all of the user-interface information to a file, including the panels.

 

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-d2b85a7e-fd08-11e4-9e07-3417ebd3d5be


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog