.swp macro
Save Drawing as DXF or DWG: batch convert drawings
Exports the open drawing to DXF or DWG. Parts and assemblies are reported as unsupported — use Save Neutral Format for those.
Download Save Drawing as DXF or DWG.swp Get SwMacroFlow
Put the downloaded file in this folder, then open SwMacroFlow and choose it from the library.
%LOCALAPPDATA%\SwMacroFlow\macros
Runs per file — point the scope at a folder and it exports every drawing in turn.
Inputs
| Field | Purpose |
|---|---|
| Format | DXF (.dxf) or DWG (.dwg). |
| OutputFolder | Where the file goes. Blank saves it beside the drawing. Created if missing. |
| OutputName | File name without an extension. Blank uses the drawing's own name. {Property} placeholders work. |
| Sheets | All sheets in one file, One file per sheet, or Active sheet only. |
| Version | AutoCAD format version, R12 through R2018. Older CAM and nesting software often insists on R12 or R2000. |
| Overwrite | On by default. Clear it to skip drawings whose output already exists. |
One file per sheet
SOLIDWORKS decorates the file name per sheet in this mode, so the final paths are not the one this macro composed. The Overwrite check is therefore skipped for One file per sheet rather than tested against a path that is not the one being written — a wrong answer would be worse than none.
Results
Reports the path it wrote and the version used, or decodes the SOLIDWORKS error:
| Reported as | Cause |
|---|---|
| The target file is read-only | The existing DXF/DWG is read-only or checked in |
| The file is locked by another program | Something else has the output open |
| DXF/DWG export is not available in the current SOLIDWORKS licence | Translator not licensed |
| The full path is longer than Windows allows | Long folder plus long property-based name |
Notes
Version and sheet handling are global SOLIDWORKS preferences, not arguments to the export. This macro reads both, sets them for the export, and puts both back on every exit path — including when an error is raised part-way through. Without that, one run would silently change what every later hand export produces.
Layer mapping is not an input here. SOLIDWORKS drives DXF/DWG layer mapping from its own export options, which each shop configures once. This macro deliberately leaves that alone and exports with whatever mapping is configured, rather than overriding a setting the shop has already tuned.
Chaining
Safe anywhere in a chain. It does not save, rebuild or close the drawing.
To emit both DXF and DWG in one pass, add this macro twice with a different Format on each row.