All Resources
Code SnippetSolidWorks API2026-03-13
Export to STEP & IGES Programmatically
Automate exporting SolidWorks parts and assemblies to STEP (.stp) and IGES (.igs) neutral formats for supplier exchange, 3D printing, and cross-platform CAD compatibility.
csharp
public void ExportToStepAndIges(ModelDoc2 model, string outputFolder)
{
int errors = 0, warnings = 0;
string title = Path.GetFileNameWithoutExtension(model.GetTitle());
// Export as STEP AP214
string stepPath = Path.Combine(outputFolder, title + ".step");
model.Extension.SaveAs3(stepPath,
(int)swSaveAsVersion_e.swSaveAsCurrentVersion,
(int)swSaveAsOptions_e.swSaveAsOptions_Silent,
null, ref errors, ref warnings);
// Export as IGES
string igesPath = Path.Combine(outputFolder, title + ".igs");
model.Extension.SaveAs3(igesPath,
(int)swSaveAsVersion_e.swSaveAsCurrentVersion,
(int)swSaveAsOptions_e.swSaveAsOptions_Silent,
null, ref errors, ref warnings);
if (errors != 0)
Debug.Print($"Export errors: {errors}, warnings: {warnings}");
}How It Works
SolidWorks detects the export format from the file extension. The SaveAs3 method handles STEP, IGES, STL, Parasolid, and other neutral formats automatically:
- Build the output path with the desired extension (.step, .stp, .igs, .iges)
- Call SaveAs3 with silent options to suppress UI prompts
- Check errors/warnings — common issues include missing references or unsupported geometry
When to Use STEP vs IGES
- STEP (AP214/AP203): The modern standard. Preserves solid geometry, assemblies, colors, and product structure. Use this for supplier exchange, 3D printing services, and cross-CAD compatibility
- IGES: Legacy format, still reliable for surface geometry and basic solids. Use when STEP isn't accepted or for older CAD systems
- Rule of thumb: Default to STEP unless a specific downstream system requires IGES
Advanced Options
For finer control over STEP export settings:
- Use the system options API to set STEP version (AP203 vs AP214) before export
- For assemblies, you can export as a single file or preserve the assembly structure
- Set export coordinate system to align the part orientation for downstream processes
Tips
- Batch export by combining this with folder traversal or PDM vault file listing
- Always check the errors return value — a value of 0 means success
- For assemblies, consider whether you want the full assembly STEP or individual part STEPs
- Some export formats (like STL) require additional export data objects — STEP and IGES do not
SolidWorks APIC#STEPIGESExport