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: 

API to get Extrusion or Revolved Surface Count

1 REPLY 1
Reply
Message 1 of 2
isocam
212 Views, 1 Reply

API to get Extrusion or Revolved Surface Count

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

1 REPLY 1
Message 2 of 2
marshaltu
in reply to: isocam

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 360 Developer
Autodesk, Inc.

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