Recently, I have been using Autodesk Fusion 360 for some complex assemblies, which often means exporting a lot of individual bodies into STEP files. If you've done this manually before, you likely know the pain of right-clicking, selecting export, waiting, and repeating the process for every single part.
I initially wrote a basic script to automate this by simply hiding all the bodies except one, exporting the main document, and then repeating the process for the next part. It worked, but there was a massive catch, very time the script toggled visibility and exported, Fusion 360 triggered a timeline recompute. Because my design was parameter-heavy with a long history, exporting a bunch of parts took an agonizingly long time while the Fusion interface locked up.
To get around this, I designed the script to completely bypass the timeline history bottleneck.
The Solution
My script takes a completely different approach to exporting. Instead of fighting the timeline on the main document, the script works like this:
- It iterates through the design and finds every body that is currently set to visible.
- It silently creates a temporary "Direct Design" document, which has no timeline history at all.
- It copies the visible bodies into this temporary document while maintaining their exact global assembly positions.
- It exports each one as a pristine
.stepfile directly to a folder you select, and does it almost instantly.
Why it's useful
Because it uses temporary direct modeling documents, there are no parametric history recomputes. What used to take a few minutes now takes seconds. The script also preserves the global coordinates of every component, so if you bring the exported STEP files into a slicer or another CAD program later, they will all assemble perfectly in place.
For naming, it automatically names the exported files based on the component and body name (e.g., Bracket:1_Body1.step). This saves you from ending up with a folder full of files mysteriously named "Body1".
Using it is pretty simple. Just hide the parts you don't want, ensure the bodies you do want are visible, and run the script from the Fusion 360 "Scripts and Add-ins" menu.
In Action
First, make sure the bodies you want to export are visible in your browser tree:
Next, pull up the Scripts and Add-ins dialog and run the step_exporter script:
It will prompt you to select a destination folder for all of your STEP files:
A quick progress dialogue pops up while it churns through the visible bodies (since it skips history recomputes, this goes very fast):
And just like that, your folder is fully stocked with cleanly named STEP files, ready to drop into your slicer or hand off!
All the python source code and instructions are available on my github here.
No comments:
Post a Comment