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 SAVE and SAVEAS commands provide a Binary option that writes binary DXF files. Such a file contains all the information present in an ASCII DXF file but in a more compact form that takes about 25 percent less file space. It 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 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 2-byte binary value (1 byte in DXF files prior to AutoCAD Release 14), and the value that follows is one of the following:
The type of data 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 values (group code 1071) 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
1071 True group code
999999 Value for the 1071 group code
SAVEAS writes binary DXF files with the same file type (.dxf) as for ASCII DXF files. The OPEN and INSERT commands automatically recognize a binary file by means of its sentinel string. You need not identify it as a binary file.
If the OPEN and INSERT commandsencounter an error in a binary DXF file, AutoCAD reports the byte address within the file where the error was detected.