API to get Extrusion or Revolved Surface Count

isocam
Collaborator

API to get Extrusion or Revolved Surface Count

isocam
Collaborator
Collaborator

Can anybody help?

 

Is it possible, using Fusion 360, to display the number of extrusions (push or pulled surfaces) or revolved surfaces in a part and display the count (for testing only) in a message box?

 

Many thanks in advance!!!!

 

Darren

0 Likes
Reply
351 Views
1 Reply
Reply (1)

marshaltu
Autodesk
Autodesk

Hello,

 

Please refer to the following sample codes. It demonstrates how to retrieve the number of extrusion in selected component. 

 

Thanks,

Marshal

 

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        occ = adsk.fusion.Occurrence.cast(ui.activeSelections.item(0).entity)
        comp = occ.component
        
        ui.messageBox('{} extrusion in component "{}"'.format(comp.features.extrudeFeatures.count, comp.name))
        
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


Marshal Tu
Fusion Developer
>
0 Likes