.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.

Export

DRW Drawings

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

FieldPurpose
FormatDXF (.dxf) or DWG (.dwg).
OutputFolderWhere the file goes. Blank saves it beside the drawing. Created if missing.
OutputNameFile name without an extension. Blank uses the drawing's own name. {Property} placeholders work.
SheetsAll sheets in one file, One file per sheet, or Active sheet only.
VersionAutoCAD format version, R12 through R2018. Older CAM and nesting software often insists on R12 or R2000.
OverwriteOn 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 asCause
The target file is read-onlyThe existing DXF/DWG is read-only or checked in
The file is locked by another programSomething else has the output open
DXF/DWG export is not available in the current SOLIDWORKS licenceTranslator not licensed
The full path is longer than Windows allowsLong 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.