Skip to documentation
DocumentationAll documentsEnglish

G-DXF(1)

NAME

g-dxf - BRL-CAD geometry to AutoCAD DXF converter

On this page

SYNOPSIS

g-dxf [-v] [-i] [-p] [-x lvl] [-X lvl] [-a abs_tol] [-r rel_tol] [-n norm_tol] [-D dist_tol] [-P ncpus] [-o output.dxf] database.g object(s)

DESCRIPTION

g-dxf converts the specified object(s) from a BRL-CAD database.g file to an AutoCAD DXF file. Each region is tessellated into triangles via the NMG boolean evaluator and written out, with one DXF layer per region colored to the nearest matching DXF color. By default geometry is emitted as 3DFACE entities; use -p to emit POLYFACE MESH entities instead. If no output file is given with -o, the DXF is written to standard output.

OPTIONS

-v

Verbose output, including object names and the tolerances in use.

-i

Output coordinates in inches instead of the default millimeters.

-p

Emit POLYFACE MESH entities instead of the default 3DFACE entities.

-x lvl

Set the librt debug flag to the given hexadecimal value.

-X lvl

Set the NMG debug flag to the given hexadecimal value.

-a abs_tol

Absolute tessellation tolerance in millimeters (the maximum chord error). Setting this disables the relative tolerance.

-r rel_tol

Relative tessellation tolerance, a fraction of the bounding box used to bound the chord error (default 0.01).

-n norm_tol

Surface normal tessellation tolerance in degrees. Setting this disables the relative tolerance.

-D dist_tol

Calculation distance tolerance in millimeters; vertices closer than this are considered identical (default 0.0005).

-P ncpus

Number of CPUs to use. Currently disabled: the value is accepted but not used.

-o output.dxf

Write to the named DXF file instead of standard output.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Convert geometry to a DXF file
g-dxf -o hull.dxf ship.g hull

Tessellate the hull region from ship.g and write the resulting 3DFACE entities to hull.dxf.

Example 2. Tighten tolerances and emit a polyface mesh in inches
g-dxf -p -i -a 0.1 -o turret.dxf ship.g turret

Export the turret region as POLYFACE MESH entities in inches, using a 0.1 mm absolute tessellation tolerance for a finer mesh suitable for import into AutoCAD-style packages.

SEE ALSO

brlcad(1), dxf-g(1), g-stl(1), g-obj(1)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org