How to convert AutoCAD DWG drawings to DXF with LibreCAD
Checked against the official docs on
LibreCAD's command-line converters turn DWG drawings into DXF (or PDF, PNG and SVG) without opening the editor: librecad dwg2dxf -o drawing.dxf drawing.dwg.
Convert one drawing
Run librecad dwg2dxf -V r2018 -o drawing.dxf drawing.dwg to turn a DWG into a DXF R2018 file. Without -o, the output is saved beside the input with the same base name.
Pick the DXF version
-V sets the DXF version: r12, r14, r2000, r2004, r2007 (the default), r2010, r2013 or r2018. Use the oldest one the receiving software needs.
Convert a batch
List several input files and use -t <directory> to choose where the outputs go. -t and -o can't be combined.
Make a PDF for review
librecad dxf2pdf -a -o drawing.pdf drawing.dxf fits and centres the drawing on the page.
Open the DXF in LibreCAD
Open the converted DXF in LibreCAD to edit it.
Watch out for
- On a server without a display, set QT_QPA_PLATFORM=offscreen for PDF, PNG and SVG conversion.
- Use librecad <command> -h for the full list of options.
Sources: github.com/LibreCAD/LibreCAD. Menus and options can change between versions; if a step doesn't match what you see, follow the linked page.