Skip to documentation
DocumentationAll documentsEnglish

DXF-G(1)

NAME

dxf-g - convert an AutoCAD DXF file to a BRL-CAD database

On this page

SYNOPSIS

dxf-g [-c] [-d] [-v] [-t _tolerance_] [-s _scale_factor_] [-h] [-?] _file.dxf_ _database.g_

DESCRIPTION

dxf-g converts an AutoCAD DXF file (file.dxf) into a BRL-CAD database (database.g). The input is expected to be in ASCII DXF format as defined in the AutoCAD 2006 manuals.

Supported DXF entity types include POLYLINE, LWPOLYLINE, LEADER, DIMENSION, VERTEX, LINE, CIRCLE, ARC, ELLIPSE, 3DFACE, TEXT, MTEXT, ATTRIB, SOLID, and SPLINE. Supported POLYLINE subtypes include 3D polylines, 3D polygon meshes, and polyface meshes. SOLID entities are 2D filled shapes, but this converter does not perform any filling.

Each DXF layer is converted to a separate BRL-CAD object, and layer colors are preserved. The inverse conversion is performed by g-dxf(1).

OPTIONS

-c

Ignore colors. By default each layer may be split into separate BOT primitives by color; with this option a single object is produced per layer regardless of the colors it contains.

-d

Enable a debug flag that requests a core dump on failure. Useful only for developers.

-v

Produce verbose progress output on standard error.

-t tolerance

Maximum distance, in millimeters, at which two vertices are considered to be the same point.

-s scale_factor

Multiply all input coordinates by scale_factor. Useful for DXF files that do not specify their units.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Convert a DXF file drawn in inches
dxf-g -s 25.4 -t 0.01 drawing_inches.dxf drawing.g

Converts a DXF file authored in inches into a millimeter-unit BRL-CAD database by scaling every coordinate by 25.4, while merging vertices that lie within 0.01 mm of one another into a single point.

Example 2. Round-trip a model through DXF
g-dxf -o part.dxf part.g component
dxf-g part.dxf part_reimport.g

Exports the object component from part.g to DXF with g-dxf(1), then re-imports the result into a new BRL-CAD database for comparison or further editing.

SEE ALSO

brlcad(1), g-dxf(1), mged(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