QCAD Command Line Tools

Every QCAD 3 installation includes some command line tools which allow batch conversion of CAD drawing files.

Under Windows, these utilities are included as batch files (.bat) in the installation directory of QCAD. Under Mac OS X, you can find the utilities as shell scripts inside the application bundle at QCAD.app/Contents/Resources. Under Linux systems, the utilities are also included as shell scripts in the installation directory of QCAD.

dwg2bmp (dwg2png, dwg2jpeg, dwg2tiff, ...)

dwg2bmp converts a DXF or DWG file into a bitmap file. Supported output formats are: BMP, ICO, JPEG, PNG, PPM, TIFF, XBM, XPM.

Usage: dwg2bmp [OPTIONS]... <drawing file>

Converts a DWG / DXF file to a Bitmap file.

  -a, -antialiasing       Enable antialiasing
  -b, -background=C       Set the background color as color name
                          e.g. 'white' or '#ccdd00'.
  -f, -force              Overwrite existing output file
  -h, -help               Display this help
  -l, -list               List supported formats
  -m, -margin=M           Set auto zoom margin to M (in pixels)
  -o, -outfile=FILE       set output file to FILE
                          default is same path and base name as input file
  -q, -quality=Q          Set the image quality / compression
                          (0=best compression..100=best quality)
  -r, -resolution=R       Set rendering resolution to R
                          (in pixels/drawing unit)
                          This overrides the width/height parameters.
  -x, -width=W            Set bitmap width to W (in pixels)
  -y, -height=H           Set bitmap height to H (in pixels)
  -p, -origin             Draw zero point (origin)

dwg2svg

dwg2svg converts a DXF or DWG file into an SVG (Scalable Vector Graphics) file. The output file can be optimized to look exactly the same as the drawing file (default) or to transfer as much of the geometry across as possible (switch -g).

Usage: dwg2svg [OPTION]... <drawing file>

Converts a DWG / DXF file to a SVG file.

  -a, -adjust             adjust page size to include thickest lineweight
  -b, -bottom=MB          set page margin at bottom to MB
  -c, -circle=CR          export points as circles with radius CR
  -e, -equalmargins=M     set all page margins to M
                          -l, -r, -t and -b are ignored
  -f, -force              Overwrite existing output file
  -g, -preservegeometry   preserve as much of the original geometry as possible
                          default is identical rendering
  -h, -help               display this help
  -i, -inkscape           generate additional information for Inkscape
  -l, -left=ML            set page margin at left to ML
  -o, -outfile=FILE       set output file to FILE
                          default is same path and base name as input file
  -p, -open               open the converted file after conversion
  -r, -right=MR           set page margin at right to MR
  -s, -scale=SF           set scale factor to SF
  -t, -top=MT             set page margin at top to MT
  -x, -cross=CS           export points as crosses with size CS

Points:    If neither -c nor -x is given, points are not exported.
SVG Units: SVG only supports the following units: mm, cm, in.
           - Unsupported Metric drawing units are converted to Millimeters.
           - Unsupported Imperial drawing units are converted to Inches.
           Use -s to scale and avoid large values.
Margins:   Margin values have to be specified in the (converted) SVG unit.

Examples:
Adjust page, set all margins to 1.5, export points as circles with radius 0.5:
dwg2svg -a -e 1.5 -c 0.5 file.dwg

Set scale factor to '1:200':
dwg2svg -s 1:200 file.dwg

dwg2pdf

dwg2pdf converts a DXF or DWG file into a PDF file. The drawing file is expected to contain information about the paper size, orientation and drawing scale and offset.

Usage: ./dwg2pdf.sh [OPTIONS]... <drawing file>

Converts a DWG / DXF file to a PDF file.

  -f, -force              Overwrite existing output file
  -h, -help               Display this help
  -o, -outfile=FILE       set output file to FILE
                          default is same path and base name as input file