Get Part Description Property Using Fusion 360 API

Get Part Description Property Using Fusion 360 API

isocam
Collaborator Collaborator
588 Views
1 Reply
Message 1 of 2

Get Part Description Property Using Fusion 360 API

isocam
Collaborator
Collaborator

Can anybody help???

 

Is it possible, using Fusion 360 API, to get the parts "Description" property and, for testing only, show the description in a message box?

 

Please see the attached picture.

 

Many thanks in advance!!!!

 

Darren

0 Likes
589 Views
1 Reply
Reply (1)
Message 2 of 2

marshaltu
Autodesk
Autodesk

Hello,

 

The following sample demos how to get description of a component.

 

Thanks,

Marshal

 

#Author-
#Description-

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        design = adsk.fusion.Design.cast(app.activeProduct)
        root = design.rootComponent
        comp = root.occurrences.item(0).component
                
        ui.messageBox('Component description: {}'.format(comp.description))                
        
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


Marshal Tu
Fusion Developer
>
0 Likes