Drawing Interchange File Formats
Binary DXF File Format
The ASCII DXF file format is a complete representation of an AutoCAD drawing in an ASCII text form, and is easily processed by other programs. In addition, AutoCAD can produce or read a binary form of the full DXF file and accept limited input in another binary file format.
The DXFOUT command provides a Binary option that writes binary dxf files. Such a file contains all of the information present in an ASCII DXF file but in a more compact form that takes, typically, 25 percent less file space and can be read and written more quickly (typically, five times faster) by AutoCAD. Unlike ASCII dxf files, which entail a trade-off between size and floating-point accuracy, binary dxf files preserve all of the accuracy in the drawing database. (AutoCAD Release 10 was the first version to support this form of DXF file; it cannot be read by older versions.)
A binary DXF file begins with a 22-byte sentinel consisting of the following:
AutoCAD Binary DXF<CR><LF><SUB><NULL>
Following the sentinel are pairs (group, value) as in an ASCII DXF file but represented in binary form. The group code is a single-byte binary value, and the value that follows is one of the following:
The type of the datum following a group is determined from the group code by the same rules used in decoding ASCII DXF files. Translation of angles to degrees and dates to fractional Julian date representation is performed for binary files, as well as for ASCII DXF files. The comment group, 999, is not used in binary DXF files.
Extended data group codes are represented in binary DXF as a single byte with the value 255, followed by a 2-byte integer value containing the actual group code, followed by the actual value.
Extended data long (group code 1071) values occupy 4 bytes of data. Extended data binary chunks (group code 1004) are represented as a single-byte, unsigned integer length, followed by the specified number of bytes of chunk data. For example, to transfer an extended data long group, the following values would appear, occupying 1, 2, and 4 bytes respectively.255 Escape group code
999999 Value for the 1071 group code
DXFOUT writes binary DXF files with the same file type (.dxf) as for ASCII DXF files. The DXFIN command automatically recognizes a binary file by means of its sentinel string. There is no need for you to identify it as a binary file.
If DXFIN encounters an error in a binary DXF file, it reports the byte address within the file where the error was detected.