The header section (section locator 0 in R13 to R2000, AcDb:Header from R2004) holds the drawing’s system variables, except MEASUREMENT, which is in the template section. The classes section (locator 1, or AcDb:Classes) declares the object types that have no fixed type number. This page follows chapters 9, 10 and 5.8 of the Open Design Alliance’s Open Design Specification for .dwg files, version 5.4.1. Data types are explained on Bit codes and data types. The names are AutoCAD’s system variable names; the DXF header variables page describes them as DXF stores them.
- Header section layout
- Header variables in file order
- The R2000 flags word
- Classes section: R13 to R2000, R2004 and later, R2007, proxy flags
Header section layout
| Type | Meaning |
|---|---|
| SN | Beginning sentinel CF 7B 1F 23 FD DE 38 A9 5F 7C 68 B8 4E 6D 33 5F |
| RL | Size of the data that follows, in bytes |
| RL | R2010 and R2013 when the maintenance version is above 3, and always from R2018: unknown, perhaps the high half of a 64-bit size |
| X | The variables below, as one bit stream with no gaps, padded with random bits to the next byte |
| RS | CRC of the data after the sentinel, starting value 0xC0C1 |
| SN | Ending sentinel 30 84 E0 DC 02 21 C7 56 A0 83 97 47 B1 92 CC A0 |
From R2007 the strings are kept in a separate string stream and the handles in a handle stream at the end of the section, as in objects. HANDSEED is the exception: it stays in the main data stream. The file structure page shows the start of the header section of an empty R14 drawing.
Header variables in file order
Each row is one or more consecutive fields of the same type, read in the order listed. “All” means every version from R13 to R2018. Handles are hard pointers unless the row says otherwise. (PS) and (MS) mark the paper space and model space copies of a variable.
| Type | Fields, in order | Versions |
|---|---|---|
| RL | Size in bits | R2007 only |
| BLL | REQUIREDVERSIONS (default 0, read only) | R2013 and later |
| BD | Four unknown values, defaults 412148564080.0, 1.0, 1.0, 1.0 | All |
| TV | Four unknown strings, default empty | All |
| BL | Two unknown values, defaults 24 and 0 | All |
| BS | Unknown, default 0 | R13–R14 |
| H | Current viewport entity header | Before R2004 |
| B | DIMASO, DIMSHO | All |
| B | DIMSAV (undocumented) | R13–R14 |
| B | PLINEGEN, ORTHOMODE, REGENMODE, FILLMODE, QTEXTMODE, PSLTSCALE, LIMCHECK | All |
| B | BLIPMODE | R13–R14 (in the registry from R2000) |
| B | Undocumented | R2004 and later |
| B | USRTIMER (user timer on or off), SKPOLY, ANGDIR, SPLFRAME | All |
| B | ATTREQ, ATTDIA | R13–R14 (registry from R2000) |
| B | MIRRTEXT, WORLDVIEW | All |
| B | WIREFRAME (undocumented) | R13–R14 |
| B | TILEMODE, PLIMCHECK, VISRETAIN | All |
| B | DELOBJ | R13–R14 (registry from R2000) |
| B | DISPSILH, PELLIPSE (not in DXF) | All |
| BS | PROXYGRAPHICS | All |
| BS | DRAGMODE | R13–R14 (registry from R2000) |
| BS | TREEDEPTH, LUNITS, LUPREC, AUNITS, AUPREC | All |
| BS | OSMODE | R13–R14 (registry from R2000) |
| BS | ATTMODE | All |
| BS | COORDS | R13–R14 (registry from R2000) |
| BS | PDMODE | All |
| BS | PICKSTYLE | R13–R14 (registry from R2000) |
| BL | Three unknown values | R2004 and later |
| BS | USERI1, USERI2, USERI3, USERI4, USERI5, SPLINESEGS, SURFU, SURFV, SURFTYPE, SURFTAB1, SURFTAB2, SPLINETYPE, SHADEDGE, SHADEDIF, UNITMODE, MAXACTVP, ISOLINES, CMLJUST, TEXTQLTY | All |
| BD | LTSCALE, TEXTSIZE, TRACEWID, SKETCHINC, FILLETRAD, THICKNESS, ANGBASE, PDSIZE, PLINEWID, USERR1, USERR2, USERR3, USERR4, USERR5, CHAMFERA, CHAMFERB, CHAMFERC, CHAMFERD, FACETRES, CMLSCALE, CELTSCALE | All |
| TV | MENUNAME | R13–R2004 |
| BL | TDCREATE (Julian day, then milliseconds into the day), TDUPDATE (day, milliseconds) | All |
| BL | Three unknown values | R2004 and later |
| BL | TDINDWG (days, milliseconds), TDUSRTIMER (days, milliseconds) | All |
| CMC | CECOLOR | All |
| H | HANDSEED: the next handle, code 0 with a length byte, in the main data stream even in R2007 and later | All |
| H | CLAYER, TEXTSTYLE, CELTYPE | All |
| H | CMATERIAL | R2007 and later |
| H | DIMSTYLE, CMLSTYLE | All |
| BD | PSVPSCALE | R2000 and later |
| 3BD | INSBASE (PS), EXTMIN (PS), EXTMAX (PS) | All |
| 2RD | LIMMIN (PS), LIMMAX (PS) | All |
| BD | ELEVATION (PS) | All |
| 3BD | UCSORG (PS), UCSXDIR (PS), UCSYDIR (PS) | All |
| H | UCSNAME (PS) | All |
| H | PUCSORTHOREF | R2000 and later |
| BS | PUCSORTHOVIEW | R2000 and later |
| H | PUCSBASE | R2000 and later |
| 3BD | PUCSORGTOP, PUCSORGBOTTOM, PUCSORGLEFT, PUCSORGRIGHT, PUCSORGFRONT, PUCSORGBACK | R2000 and later |
| 3BD | INSBASE (MS), EXTMIN (MS), EXTMAX (MS) | All |
| 2RD | LIMMIN (MS), LIMMAX (MS) | All |
| BD | ELEVATION (MS) | All |
| 3BD | UCSORG (MS), UCSXDIR (MS), UCSYDIR (MS) | All |
| H | UCSNAME (MS) | All |
| H | UCSORTHOREF | R2000 and later |
| BS | UCSORTHOVIEW | R2000 and later |
| H | UCSBASE | R2000 and later |
| 3BD | UCSORGTOP, UCSORGBOTTOM, UCSORGLEFT, UCSORGRIGHT, UCSORGFRONT, UCSORGBACK | R2000 and later |
| TV | DIMPOST, DIMAPOST | R2000 and later |
| B | DIMTOL, DIMLIM, DIMTIH, DIMTOH, DIMSE1, DIMSE2, DIMALT, DIMTOFL, DIMSAH, DIMTIX, DIMSOXD | R13–R14 |
| RC | DIMALTD, DIMZIN | R13–R14 |
| B | DIMSD1, DIMSD2 | R13–R14 |
| RC | DIMTOLJ, DIMJUST, DIMFIT | R13–R14 |
| B | DIMUPT | R13–R14 |
| RC | DIMTZIN, DIMALTZ, DIMALTTZ, DIMTAD | R13–R14 |
| BS | DIMUNIT, DIMAUNIT, DIMDEC, DIMTDEC, DIMALTU, DIMALTTD | R13–R14 |
| H | DIMTXSTY | R13–R14 |
| BD | DIMSCALE, DIMASZ, DIMEXO, DIMDLI, DIMEXE, DIMRND, DIMDLE, DIMTP, DIMTM | All |
| BD | DIMFXL, DIMJOGANG | R2007 and later |
| BS | DIMTFILL | R2007 and later |
| CMC | DIMTFILLCLR | R2007 and later |
| B | DIMTOL, DIMLIM, DIMTIH, DIMTOH, DIMSE1, DIMSE2 | R2000 and later |
| BS | DIMTAD, DIMZIN, DIMAZIN | R2000 and later |
| BS | DIMARCSYM | R2007 and later |
| BD | DIMTXT, DIMCEN, DIMTSZ, DIMALTF, DIMLFAC, DIMTVP, DIMTFAC, DIMGAP | All |
| T | DIMPOST, DIMAPOST, DIMBLK, DIMBLK1, DIMBLK2 | R13–R14 |
| BD | DIMALTRND | R2000 and later |
| B | DIMALT | R2000 and later |
| BS | DIMALTD | R2000 and later |
| B | DIMTOFL, DIMSAH, DIMTIX, DIMSOXD | R2000 and later |
| CMC | DIMCLRD, DIMCLRE, DIMCLRT | All |
| BS | DIMADEC, DIMDEC, DIMTDEC, DIMALTU, DIMALTTD, DIMAUNIT, DIMFRAC, DIMLUNIT, DIMDSEP, DIMTMOVE, DIMJUST | R2000 and later |
| B | DIMSD1, DIMSD2 | R2000 and later |
| BS | DIMTOLJ, DIMTZIN, DIMALTZ, DIMALTTZ | R2000 and later |
| B | DIMUPT | R2000 and later |
| BS | DIMATFIT | R2000 and later |
| B | DIMFXLON | R2007 and later |
| B | DIMTXTDIRECTION | R2010 and later |
| BD | DIMALTMZF | R2010 and later |
| T | DIMALTMZS | R2010 and later |
| BD | DIMMZF | R2010 and later |
| T | DIMMZS | R2010 and later |
| H | DIMTXSTY, DIMLDRBLK, DIMBLK, DIMBLK1, DIMBLK2 | R2000 and later |
| H | DIMLTYPE, DIMLTEX1, DIMLTEX2 | R2007 and later |
| BS | DIMLWD, DIMLWE | R2000 and later |
| H | Control objects (hard owner): BLOCK, LAYER, STYLE, LINETYPE, VIEW, UCS, VPORT, APPID, DIMSTYLE | All |
| H | VIEWPORT ENTITY HEADER control object (hard owner) | R13–R2000 |
| H | Dictionaries ACAD_GROUP and ACAD_MLINESTYLE (hard pointers), then the named objects dictionary (hard owner) | All |
| BS | TSTACKALIGN (default 1), TSTACKSIZE (default 70); neither is in DXF | R2000 and later |
| TV | HYPERLINKBASE, STYLESHEET | R2000 and later |
| H | Dictionaries LAYOUTS, PLOTSETTINGS, PLOTSTYLES | R2000 and later |
| H | Dictionaries MATERIALS, COLORS | R2004 and later |
| H | Dictionary VISUALSTYLE | R2007 and later |
| H | Unknown | R2013 and later |
| BL | Flags: CELWEIGHT, ENDCAPS, JOINSTYLE, LWDISPLAY, XEDIT, EXTNAMES, PSTYLEMODE, OLESTARTUP | R2000 and later |
| BS | INSUNITS, CEPSNTYPE | R2000 and later |
| H | CPSNID, only when CEPSNTYPE is 3 | R2000 and later |
| TV | FINGERPRINTGUID, VERSIONGUID | R2000 and later |
| RC | SORTENTS, INDEXCTL, HIDETEXT, XCLIPFRAME (0 or 1 only before R2010), DIMASSOC, HALOGAP | R2004 and later |
| BS | OBSCUREDCOLOR, INTERSECTIONCOLOR | R2004 and later |
| RC | OBSCUREDLTYPE, INTERSECTIONDISPLAY | R2004 and later |
| TV | PROJECTNAME | R2004 and later |
| H | BLOCK_RECORD *PAPER_SPACE, BLOCK_RECORD *MODEL_SPACE, LTYPE BYLAYER, LTYPE BYBLOCK, LTYPE CONTINUOUS | All |
| B | CAMERADISPLAY | R2007 and later |
| BL | Two unknown values | R2007 and later |
| BD | Unknown, then STEPSPERSEC, STEPSIZE, 3DDWFPREC, LENSLENGTH, CAMERAHEIGHT | R2007 and later |
| RC | SOLIDHIST, SHOWHIST | R2007 and later |
| BD | PSOLWIDTH, PSOLHEIGHT, LOFTANG1, LOFTANG2, LOFTMAG1, LOFTMAG2 | R2007 and later |
| BS | LOFTPARAM | R2007 and later |
| RC | LOFTNORMALS | R2007 and later |
| BD | LATITUDE, LONGITUDE, NORTHDIRECTION | R2007 and later |
| BL | TIMEZONE | R2007 and later |
| RC | LIGHTGLYPHDISPLAY, TILEMODELIGHTSYNCH, DWFFRAME, DGNFRAME | R2007 and later |
| B | Unknown | R2007 and later |
| CMC | INTERFERECOLOR | R2007 and later |
| H | INTERFEREOBJVS, INTERFEREVPVS, DRAGVS | R2007 and later |
| RC | CSHADOW | R2007 and later |
| BD | Unknown | R2007 and later |
| BS | Four unknown shorts (“type 5/6 only”; they do not seem to be required) | R14 and later |
| RS | CRC (see layout) | All |
The R2000 flags word
From R2000 several variables are packed into one BL:
| Variable | Bits |
|---|---|
| CELWEIGHT | Flags & 0x001F |
| ENDCAPS | Flags & 0x0060 |
| JOINSTYLE | Flags & 0x0180 |
| LWDISPLAY | Set when 0x0200 is clear |
| XEDIT | Set when 0x0400 is clear |
| EXTNAMES | Flags & 0x0800 |
| PSTYLEMODE | Flags & 0x2000 |
| OLESTARTUP | Flags & 0x4000 |
Classes section
Object types with no fixed number (type 500 and above) are defined here. An object of type t is of the class at index t − 500 in this list, and the class’s DXF name says what the object is; see object types.
R13 to R2000
| Type | Meaning |
|---|---|
| SN | Sentinel 8D A1 C4 B8 C4 A9 F8 C5 C0 DC F4 5F E7 CF B6 8A |
| RL | Size of the class data area |
| X | Class records, repeated until the data runs out (below) |
| RS | CRC |
| SN | Sentinel 72 5E 3B 47 3B 56 07 3A 3F 23 0B A0 18 30 49 75 |
| Type | Field | Meaning |
|---|---|---|
| BS | classnum | Class number |
| BS | version | In R14 this became a flag saying whether objects can be moved, edited and so on (still being examined by the ODA) |
| TV | appname | Application name |
| TV | cplusplusclassname | C++ class name |
| TV | classdxfname | DXF name |
| B | wasazombie | Was a proxy (zombie) |
| BS | itemclassid | 0x1F2 for classes that produce entities, 0x1F3 for classes that produce objects |
R2004 and later
Compressed, with the standard 32-byte page header. For R2004 and later, 8 unknown bytes follow the ending sentinel (the ODA writes zeros).
| Type | Meaning |
|---|---|
| SN | Sentinel 8D A1 C4 B8 C4 A9 F8 C5 C0 DC F4 5F E7 CF B6 8A |
| RL | Size of the class data area |
| RL | R2010 and later, when the maintenance version is above 3: unknown, perhaps the high half of a 64-bit size |
| BS | Maximum class number |
| RC | 0x00 |
| RC | 0x00 |
| B | True |
| X | Class records, repeated until the data runs out (below) |
| RS | CRC |
| SN | Sentinel 72 5E 3B 47 3B 56 07 3A 3F 23 0B A0 18 30 49 75 |
| Type | Field | Meaning |
|---|---|---|
| BS | classnum | Class number |
| BS | proxy flags | Below |
| TV | appname | Application name (in the string stream from R2007) |
| TV | cplusplusclassname | C++ class name |
| TV | classdxfname | DXF name |
| B | wasazombie | Was a proxy |
| BS | itemclassid | 0x1F2 entities, 0x1F3 objects |
| BL | count | Number of objects of this class in the drawing (DXF 91) |
| BS | DWG version | – |
| BS | maintenance version | – |
| BL | – | Unknown, normally 0 |
| BL | – | Unknown, normally 0 |
R2007
Section 5.8 of the specification gives the R2007 classes section with a string stream for its Unicode strings:
| Type | Meaning |
|---|---|
| SN | Sentinel, as above |
| RL | Size of the class data area in bytes |
| RL | Total size in bits |
| BL | Maximum class number |
| B | A boolean value |
| X | Class data |
| X | String stream data |
| B | True if string stream data is present |
Its class records are as for R2004 except that the names are TU and the DWG version and maintenance version are BL rather than BS.
Proxy flags
| Value | Meaning |
|---|---|
| 1 | Erase allowed |
| 2 | Transform allowed |
| 4 | Colour change allowed |
| 8 | Layer change allowed |
| 16 | Linetype change allowed |
| 32 | Linetype scale change allowed |
| 64 | Visibility change allowed |
| 128 | Cloning allowed |
| 256 | Lineweight change allowed |
| 512 | Plot style name change allowed |
| 1024 | Disables the proxy warning dialogue |
| 32768 | R13 format proxy |
Not confirmed
- The four BD, four TV and two BL values at the start of the header, and the other values marked unknown above, have no known meaning; the specification gives only defaults.
- Chapter 10 says the 8 bytes after the classes sentinel appear “for R18 and later” in its R13 to R15 part, and does not repeat it for R2004 and later.
- The R2007 class layout (section 5.8) and the R2004 one (section 10.2) do not match in the fields before the class records (RL bit size, BL maximum class number, no two zero RCs); this page gives both as printed.
Sources
- Open Design Specification for .dwg files, version 5.4.1 – Open Design Alliance; chapter 9 (header variables), chapter 10 (classes), sections 5.8 and 5.9 (R2007 classes and header) and chapter 8 (R2018)