NAME - Converts files in DXF format to ASCII or binary GRASS vector file format.
(GRASS Vector Data Import Program)

SYNOPSIS help [ -a] dxf=name [lines=name[,name,...]] \ [labels=name[,name,...]] [prefix=name]


The data conversion program generates GRASS dig, dig_ascii, and dig_att files from a file in DXF format. Each layer in the DXF input file is converted to a separate dig (or dig_ascii) layer. For each DXF layer containing text, a dig_att file is also created. These output files are placed in the dig, dig_ascii, and dig_att directories under the user's current GRASS mapset.

Output from this program is designed to be used as input to the program v.cadlabel.

The program will only recognize points, lines, polylines, and text in the DXF format, and will translate these to GRASS vector format; other types of data are ignored.


Output an ASCII GRASS vector (dig_ascii) file rather than a binary GRASS vector (dig) file.


Name of the DXF input design file to be converted to GRASS vector format.
"lines=name[,name,...] or lines=in_name:out_name[,in_name:out_name,...]"
Name(s) of layer(s) in the DXF input file containing line data, and (optionally) the name(s) to be assigned to the GRASS vector data (dig or dig_ascii) files output.
Default: Convert each layer containing data in the \Idxf file to a GRASS vector data (dig or dig_ascii) file.
"labels=name[,name,...] or labels=in_name:out_name[,in_name:out_name,...]"
Name(s) of layer(s) in the DXF input file containing text labels, and (optionally) the name(s) to be assigned to the GRASS vector attribute (dig_att) files output.
Default: Convert each layer containing text labels in the dxf map to a GRASS vector attribute (dig_att) file.
Prefix assigned to the dig or dig_ascii and dig_att output file names.

The names of the GRASS vector (dig, dig_ascii, and dig_att) files output are constructed as prefix.extension, where prefix is the prefix name specified by the user and extension is the number of the DXF layer from which the data were obtained. If the user does not specify a prefix name, the output files take their prefix from the prefix of the input DXF map layer. For example, for the DXF file named streams.dxf containing line data on layer , the GRASS vector map layer output would be named streams..


Outputs line data in DXF layer 15.
Outputs line data in DXF layers 15 and 16.
Converts line data in DXF layers ROADS and WATER.
Outputs line data in DXF layer 15, and places it in the dig (or dig_ascii) file for DXF layer 16.

The below examples are given for a DXF design file named cont.dxf containing contour lines and contour line labels, in which:

index contour lines are in DXF layer 9,
intermediate contour lines are in DXF layer 11, and
index labels and some intermediate contour lines are in DXF layer 12. can be run with default values, as shown below: dxf=cont.dxf

Here, this is equivalent to running the following command: dxf=cont.dxf lines=9,11,12 labels=12

Either of the above commands will produce three GRASS dig files (named cont.9, cont.11, and cont.12) and one dig_att file (named cont.12).

In our example, however, the cont.12 file contains intermediate contour lines that the user would like to add to the dig file cont.11. Our user also wishes to use a different file prefix than the default prefix cont. The user therefore types the following command: dxf=cont.dxf lines=9,11,12:11 labels=12 prefix=contour

The above command will generate three dig files (named contour.9, contour.11, contour.12), and will create one dig_att file containing text labels (called contour.12). No contour lines will appear in the dig_att file.


Output Filenames:
The output filename, prefix.extension, conforms with the GRASS limit of 14 characters. The entire prefix name is used, a '.' inserted, and as much of the extension name is used as the 14 character limit will permit. Excess characters are truncated. To minimize the possibility of creating output files with the same names (resulting in loss of data from the DXF file), use the prefix option to abbreviate the DXF file name. This will leave the majority of characters available for differentiating between layer names.

This data translation program does not contain any of the quality control functions available in v.digit that will prevent data in an improper format from being input to a GRASS data base. If present, DXF entities are placed in output file(s) corresponding to the layers on which they occurred in the DXF design file input.

If the user asks to output ASCII vector (dig_ascii) files, they must be converted to binary vector format before they are usable by most GRASS vector commands. The user can convert GRASS vector files from ASCII to binary format by running such programs as or After conversion to binary format the vector files can be displayed (e.g., with d.vect); however, the user must run on the binary vector files before they can be edited in v.digit. The files output by will preserve the data in whatever form they exist in the DXF file. This means that output files may contain unsnapped nodes, overshoots, gaps, and replicated lines. The data, and the file header information (including the owner's name, map's name, date, and scale, and UTM zone) for the GRASS vector files output may require editing by the user in v.digit.

The program attaches attributes only to DXF text data that are converted to GRASS vector data (such as contour line labels). Attributes are not attached to converted DXF line data. For each layer of text data in the DXF design file, generates a vector file consisting of rectangular boxes (lines) that are drawn around the DXF text data, and uses the text values to create a GRASS attribute file for the boxes. The vector and attribute files can then be used to label contour lines with the v.cadlabel program.


v.cadlabel, v.digit,, v.out.dxf,


Original dxf2dig program written by Jan Moorman, U.S. Army Construction Engineering Research Laboratory (6/89)

Revised by Dave Gerdes, U.S. Army Construction Engineering Reseach Laboratory (12/89)

Revised and appended by Jan Moorman, U.S. Army Construction Engineering Research Laboratory (7/90)

Code for arcs and circles from National Park Service GIS Division written by Tom Howard.