Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to export hundreds of bodies as individual steps locally (on my HD)?

luca.giorcelli
Enthusiast

How to export hundreds of bodies as individual steps locally (on my HD)?

luca.giorcelli
Enthusiast
Enthusiast

I need to save locally, on my HD, all bodies of my design as individual step files.

 

I've found an interesting solution here: How to save hundreds of individual parts/bodies from an assembly in STEP?

But it is not useful for me because it saves step files in cloud, not locally on HD. This seems to be a dead point because, once you have saved all steps on Autodesk cloud, bulk downloading seems to be not possible, as stated here: Downloading a Folder of Parts.

 

 

0 Likes
Reply
959 Views
7 Replies
Replies (7)

JeromeBriot
Mentor
Mentor
0 Likes

scottmoyse
Mentor
Mentor

You might be better off using the Fusion Team API in conjunction with the Forge API's to do it rather than the Fusion 360 API. I suppose it depends if you want to be doing this all the time or not.


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes

luca.giorcelli9CG7C
Contributor
Contributor

Thanks. I've tried it but nothing happens. Neither in cloud nor on my HD.

0 Likes

JeromeBriot
Mentor
Mentor

Here is a soluton that export each component in a step file on the desktop:

import adsk.core, adsk.fusion, traceback
import platform
import os
    
def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        # get active design        
        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)
        
        # create a single exportManager instance
        exportMgr = design.exportManager
            
        # set export location
        if platform.system() == 'Windows':
            desktopPath = os.path.join(os.getenv('USERPROFILE'), 'Desktop')
        else:
            desktopPath = os.path.join(os.path.expanduser('~'), 'Desktop')

        # export the component  one by one in the design to a specified file
        allComponents = design.allComponents
        for component in allComponents:
            fileName = os.path.join(desktopPath, component.name)               
            # export the component with STP format
            stepExportOptions = exportMgr.createSTEPExportOptions(fileName)            
            exportMgr.execute(stepExportOptions)

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

 

If you want to export one body per file, you can create a new component and copy the body to export into it (same idea as what @BrianEkins suggested in the other discussion).

 

0 Likes

luca.giorcelli9CG7C
Contributor
Contributor

F-A-N-T-A-S-T-I-C

you cannot imagine how many days of work your script will save for me.

0 Likes

luca.giorcelli9CG7C
Contributor
Contributor

PROBLEM
I've opened the stp files generated by the script (they are 116) and each of them contains the entire design, not the single iterated component.

0 Likes

luca.giorcelli9CG7C
Contributor
Contributor

UPDATE

I found the solution by myself here: http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-4a7d702d-30b6-4c51-9bb2-1357f0857d78

 

I've added the parameter "geometry"

 

Thanks

2 Likes