This SolidWorks VBA macro exports all configurations of the active part or assembly to individual STL files.
It is designed for users who manage multiple configurations (e.g., via Design Tables) and want a quick, automated way to generate STL files for each one.
Key features:
- Exports every configuration as an STL file
- Filenames are based on configuration names (invalid characters replaced)
- Creates an
STL_Exportsfolder next to your model automatically - Uses your last-set STL export settings (resolution, units, binary/ASCII)
- Supports both parts and assemblies (assemblies exported as one STL file)
- SolidWorks (any recent version that supports VBA macros)
- A saved SolidWorks part (
.sldprt) or assembly (.sldasm) file with multiple configurations - STL export settings already configured in SolidWorks
- Download the
config2stl.swpmacro file from this repository. - Open SolidWorks and your part/assembly file.
- Go to Tools → Macro → Run...
- Select the downloaded
config2stl.swpfile and click Open.
- Before running the macro, set your STL export options:
- File → Save As → STL → Options...
- Configure resolution, units, and binary/ASCII settings
- Click OK and cancel the Save As dialog (settings will be saved)
- Run the macro.
- The macro will:
- Loop through all configurations
- Export each as an STL file
- Place them in a subfolder
STL_Exportsin the same location as your model
- Output folder name: Change the
OUTPUT_SUBFOLDERconstant in the macro code. - Assembly export mode: Macro currently exports assemblies as a single STL; this can be modified if needed.
- Filename sanitization: The macro replaces invalid filename characters with underscores.
If your file is located at:
C:\Projects\MyPart.SLDPRT
After running the macro, you’ll get:
C:\Projects\STL_Exports\
Config1.stl
Config2.stl
Config3.stl