DXF Reference 14
April 95
Introduction
ASCII DXF File Format
Binary DXF File Format
DXB Files
This online reference updates chapter 13 of the AutoCAD Release 13 Developer's Guide (dated earlier than 14 April 1995).
Note The DXF group codes presented in this reference should be used instead of the group codes described in the AutoCAD Release 13 Customization Guide (publication number 00105-010000-5040, dated 13 September 1994).
The following labels may be included in group code descriptions:
DXF: Describes
how the code applies to DXF files
DXF only: Indicates
that this code is found only in DXF files
Application: Describes
how the code applies to AutoLISP, ADS, and ARX applications
Application only: Indicates
that this code is found only in AutoLISP, ADS, and ARX applications
Drawing Interchange File Formats
AutoCAD can be used as a complete drawing editor. However, in some applications, other programs must examine AutoCAD drawings or generate drawings to be viewed, modified, or plotted with AutoCAD. Three types of file formats for importing and exporting drawing data are described in this chapter.
Drawing Interchange Format (DXF) files enable the
interchange of drawings between AutoCAD and other programs. DXF files can be
either ASCII or binary formats. All implementations of AutoCAD accept the ASCII
DXF format (however, backwards compatibility is not guaranteed). ASCII DXF
files can be easily translated to the formats of other CAD systems or submitted
to other programs for specialized analysis. Because ASCII DXF files are more
common than the binary format, this chapter uses the term DXF file when
referring to ASCII DXF files and the term binary DXF files when referring to
the binary format.
Both ASCII and binary DXF files contain a
complete description of the AutoCAD drawing. Because much of the data in an
AutoCAD drawing does not have an equivalent object type in other programs, the
Drawing Interchange Binary (DXB) file format is provided, which creates a
simpler geometric description of the drawing.
Note It is recommended that you not create programs to
read .dwg files. The format of this file can change significantly as new
features are added to AutoCAD.
ASCII DXF File Format
This section describes the format of ASCII DXF files. It contains information that is needed only if you write your own programs to process DXF files or work with entity information obtained by AutoLISP and ADS applications.
New for AutoCAD Release13
General File Structure
DXF File Structure
Group Codes
File Sections
HEADER Section
CLASSES Section
TABLES Section
BLOCKS Section
ENTITIES Section
OBJECTS Section
Advanced DXF Issues
Database Objects
Persistent Inter-Object Reference Handles
Subclass Markers
Extension Dictionary and Persistent Reactors
Extended Data
Object Coordinate Systems (OCS)
Writing DXF Interface Programs
New for AutoCAD
Release13
The following rules and conventions are new in AutoCAD Release 13 and apply directly to DXF files:
n Handles
are always enabled.
n All
database objects (including symbol tables, symbol table entries, and
dictionaries) have handles and may have extended data (xdata) and persistent
reactors.
n Group
order independence is de-emphasized.
For more information on new DXF concepts, see Advanced DXF Issues.
The new DXF file sections are CLASSES and OBJECTS. A new table, BLOCK_RECORD, has been added to the TABLES section.
The new group codes and group code ranges are as follows:
New group
codes
Group codes Description
60 Entity
visibility
90-99 32-bit
integer values
100 Subclass
marker group code
102 Control
string
105 Dimension
style handles
280-289 8-bit
integer values
300-309 Arbitrary
text strings
310-319 Arbitrary
binary chunks
320-329 Arbitrary
handles
330-339 Soft
pointer handle
340-349 Hard
pointer handle
350-359 Soft
owner handle
360-369 Hard
owner handle
Some of the new group codes represent new data types, such as 8-bit and 32-bit integer values, while others perpetuate the ever-expanding dimension style symbol table. Also, specific group codes have been added for various new fields and structures associated with entities and objects, such as object references and linetype scaling. The new group codes are defined in order to give application developers a few codes for each data type with the intent of reusing the currently available group code ranges as needed.
Programs parsing DXF files and result buffer chains in ADS and AutoLISP that are intended to be tolerant of new AutoCAD versions are supposed to ignore group codes they do not recognize. It is trivial for ADS, AutoLISP, and ARX programs to do so, as well as for ASCII DXF programs. Binary DXF is another matter, because if the DXF readers do not recognize a group code, they have no easy way to skip it.
General File
Structure
Essentially a DXF file is composed of pairs of codes and associated values. The codes, known as group codes, indicate the type of value that follows. Using these group code and value pairs, a DXF file is organized into sections, which are composed of records, which in turn are composed of a group code and a data item. Each group code and value are on their own line in the DXF file.
Each section starts with a group code 0 followed by the string, SECTION. This is followed by a group code 2 and a string indicating the name of the section (for example, HEADER). Each section is composed of group codes and values that define its elements. A section ends with a 0 followed by the string ENDSEC.
It may be helpful to produce a DXF file from a small drawing, print it out, and refer to it while reading the information presented next.
DXF File Structure
The overall organization of a DXF file is as follows:
n HEADER
section. General information about the drawing is
found in this section. It consists of an AutoCAD database version number and a
number of system variables. Each parameter contains a variable name and its
associated value.
n BLOCKS
section. Holds the information for application-defined
classes, whose instances appear in the BLOCKS, ENTITIES, and OBJECTS sections
of the database. A class definition is permanently fixed in class hierarchy.
n TABLES
section. This section contains definitions for the
following symbol tables.
APPID
(application identification table)
DIMSTYLE
(dimension style table)
LAYER
(layer table)
LTYPE
(linetype table)
STYLE
(text style table)
UCS
(User Coordinate System table)
VIEW
(view table)
VPORT
(viewport configuration table)
BLOCK_RECORD
n BLOCKS
section . Contains block
definition and drawing entities that make up each block reference in the
drawing.
n ENTITIES
section. This section contains the
graphical objects (entities) in the drawing, including block references (insert
entities).
n OBJECTS
section. Contains the
nongraphical objects in the drawing. All objects that are not entities or
symbol table records or symbol tables are stored in this section. Examples of
entries in the OBJECTS section are dictionaries that contain mline styles and
groups.
If you use the Entities option of the DXFOUT
command, the resulting DXF file contains only the ENTITIES section and the EOF
marker. The ENTITIES section contains only the objects you select for output.
If you select an insert entity, the corresponding block definition is not
included in the output file.
Group Codes
Group codes and the associated values define a specific aspect of an object or entity. The line immediately following the group code is the associated value. This value can be a a string, an integer, or a floating-point value, such as the X coordinate of a point. The lines following the second line of the group, if any, are determined by the group definition and the data associated with the group.
Special group codes are used as file separators, such as markers for the beginning and end of sections, tables, and the end of the file itself.
Entities, objects, classes, tables and table entries, and file separators are introduced with a 0 group code that is followed by a name describing the group.
The maximum DXF file string length is 256 characters. If your AutoCAD drawing contains strings that exceed this number, those strings are truncated during DXFOUT. DXFIN fails if your DXF file contains strings that exceed this number.
ASCII Control Characters
Group Code Ranges
Group Code Description by Number
Object and Entity Codes
ASCII Control
Characters
DXFOUT handles ASCII control characters in text strings by expanding the character into a caret (^) followed by the appropriate letter. For example, an ASCII Control-G (BEL, decimal code 7) is output as ^G. If the text itself contains a caret character, it is expanded to caret, space (^ ). DXFIN performs the complementary conversion.
Group Code Ranges
Group codes define the type of the associated value as an integer, a floating-point number, or a string, according to the following table of group code ranges.
Group code
ranges
Code range Group
value type
-5 - -1 Used
only by AutoLISP, ADS, and ARX applications. Values vary
0 -9 String
10 -37 DXF:
Floating point value. Application: A
list of two or three reals (a point)
38 - 59 Floating
point value
60 -79 16-bit
integer value
90 -99 32-bit
integer value
100 String
102 String
105 String
representing hex. handle value
140 -147 Floating
point value
170 -175 16-bit
integer value
280 -289 8-bit
integer value
300 -309 Arbitrary
text string
310 -319 String
representing hex. value of binary chunk
320 -369 String
representing hex. handle value
999 Comment
(string). Used only by DXF files.
1000 -1009 String
1010 -1059 Floating
point value
1060 -1069 16-bit
integer value
1071 32-bit
integer value
Group Code
Description by Number
The following table below gives the group code or group code range accompanied by an explanation of the group code value. Group codes used only by AutoLISP, ADS, and ARX applications are indicated below.
AutoCAD group
codes (by number)
Group code Description
-5 Persistent
reactor chain (applications only)
-4 Conditional
operator, used with ssget and ads_ssget() (applications only)
-3 Extended
data (xdata) sentinel (fixed)
(applications only)
-2 Entity
name reference (fixed) (applications
only)
-1 Entity
name. This changes each time a drawing is opened. It is never saved.
(fixed) (applications only)
0 Identifies
the start of an entity, table, table entry, or file separator. The type of
entity is given by the text value that follows this group.
1 The
primary text value for an entity or proprietary geometry data.
2 A
name attribute tag, block name, and so on. Also used to identify a DXF section,
table name, or table entry name.
3 -4 Other
textual or name values.
5 Object
handle expressed as a hexadecimal string (fixed). All objects, entities, symbol
tables, and symbol table entries have handles. The HEADER section is not an
object and does not have a handle.
Exception DIMSTYLE table entry uses group code 105 as the object
handle.
6 Linetype
name.
7 Text
style name.
8 Layer
name.
9 Variable
name identifier (used only in HEADER section of the DXF file).
10 DXF:
X value of the primary coordinate.
Applications: The primary coordinate (2D or 3D point).
11 -18 DXF:
Other X values. Applications:
Other coordinates (2D or 3D point).
20 DXF
only: Y value of the primary coordinate. 2n values always
correspond to 1n values and immediately follow them in the file.
21 -28 DXF
only: Other Y values.
30 DXF
only: Z value of the primary coordinate. 3n values always correspond
to1n and 2n values and immediately follow them in the file.
31 -37 DXF
only: Other Z values.
38 This
entity's elevation if nonzero. Exists only in output from versions prior to
AutoCAD Release 11.
39 Entity's
thickness if nonzero.
40 -48 Floating-point
values (text height, scales, and so on).
48 Linetype
scale. Floating-point scalar value. Default value is defined for all entity
types.
49 Repeated value. Multiple 49 groups may appear in one
entity for variable length tables (such as the dash lengths in the LTYPE
table). A 7x group always appears before the first 49 group to specify
the table length.
50 -59 Angles
(output in degrees to DXF files and radians through applications).
60 Entity
visibility. Integer value. Absence or 0 indicates visibility, 1 indicates
invisibility.
62 Color
number.
66 Entities
follow flag.
67 Identifies
whether entity is in model space or paper space.
68 Identifies
whether viewport is on but fully off screen, is not active, or is off.
69 Viewport
identification number.
70 -78 Integer
values such as repeat counts, flag bits, or modes.
90 -99 32-bit
integers.
100 Subclass
data marker (with derived class name as a string). Required for all objects and
entity classes that are derived from another concrete class to segregate data
defined by different classes in the inheritance chain for the same object.
This
is in addition to the requirement for DXF names for each distinct concrete
class derived from ARX. See Subclass Markers.
102 Control
string, followed by "{<arbitrary name>" or "}". Similar to the xdata 1002
group code, except that when the string begins with {, it can be followed by an
arbitrary string whose interpretation is up to the application.
The only other allowable control
string is }, as
a group terminator.
As noted before, AutoCAD does not
interpret these strings except during drawing audit operations; they are for
application use.
105 DIMSTYLE symbol table entry object handle
(because 5 has already been used, in Release 12.
210 DXF: X component of extrusion direction.
Appplication: Extrusion direction vector
220,230 DXF
only: Y and Z components of extrusion direction.
280 -289 8-bit
integers.
300 -309 Arbitrary
text strings.
310 -319 Arbitrary
binary chunks, with same representation and limits as 1004 group codes:
hexadecimal strings of up to 254 characters represent data chunks of up to 127
bytes.
320 -329 Arbitrary
object handles. Handle values that are taken "as is." They are not
translated during insert and xref operations.
330 -339 Soft
pointer handle. Arbitrary soft pointers to other objects within same DXF file.
Translated during INSERT and XREF operations.
340 -349 Hard
pointer handle. Arbitrary hard pointers to other objects within same DXF file.
Translated during INSERT and XREF operations.
"
350 -359 Soft
owner handle. Arbitrary soft ownership links to other objects within same DXF
file. Translated during INSERT and XREF operations.
360 -369 Hard
owner handle. Arbitrary hard ownership links to other objects within same DXF
file. Translated during INSERT and XREF operations.
999 DXF
only: The 999 group code indicates that the line following it is a comment
string. DXFOUT does not include such groups in a DXF output file, but DXFIN
honors them and ignores the comments. You can use the 999 group to include
comments in a DXF file you've edited.
1000 An
ASCII string (up to 255 bytes long) in extended data.
1001 Registered
application name (ASCII string up to 31 bytes long) for extended data.
1002 Extended
data control string ({or });.
1003 Extended data layer name.
1004 Chunk of bytes (up to 127 bytes long) in
extended data.
1005 Extended data database handle.
1010 DXF: Extended data X value.
Application: Extended data coordinate.
1020,1030 DXF
only: Extended data Y and Z values.
1011 DXF:
Extended data X value of 3D world space position coordinate. Application: Extended data coordinate of 3D
world space position.
1021,1031 DXF
only: Extended data Y and Z values of 3D world space position
coordinate.
1012 DXF:
Extended data X component of 3D world space displacement. Application: Extended data 3D world space
displacement.
1022,1032 DXF
only: Extended data Y and Z components of 3D world space
displacement.
1013 DXF:
Extended data X component of 3D world space direction. Application: Extended data 3D world space
direction.
1023,1033 DXF
only: Extended data Y and Z components of 3D world space
direction.
1040 Extended
data floating-point value.
1041 Extended
data distance value.
1042 Extended
data scale factor.
1070 Extended
data 16-bit signed integer.
1071 Extended
data 32-bit signed long.
Object and Entity
Codes
In DXF, the definition of objects differs from entities: objects have no graphical representation and entities do. For example, dictionaries are objects, not entities. Entities are also referred to as graphical objects while objects are referred to as nongraphical objects.
An entity and items appear in both the BLOCK and ENTITIES sections of the DXF file. The appearance of entities in the two sections is identical.
Some group codes that define an entity always appear; others are optional and appear only if their values differ from the defaults.
Programs that read DXF files should not assume that the groups describing an entity occur in the order given here. The end of an entity is indicated by the next 0 group, which begins the next entity or indicates the end of the section.
Note As AutoCAD is further enhanced, new group codes will be added to entities to accommodate additional features. Accommodating DXF files from future releases of AutoCAD will be easier if you write your DXF processing program in a table-driven way, ignore undefined group codes, and make no assumptions about the order of group codes in an entity.
For all objects and entities, AutoCAD uses the group codes described in the following table. Note that the handle (5) group code must be output immediately after the 0 group code for nongraphical objects.
Overall
object (or entity) structure
Group code Description
0 Object
DXF name, such as Line or Layer.
5 Object
handle: Must be output immediately after 0 group code for nonentity objects.
6 Entity
linetype; not output for nonentity objects. Linetype name (if not BYLAYER). The
special name BYBLOCK indicates a floating linetype.
8 Entity
layer name, not output for nonentity objects.
48 Linetype
scale, not output for nonentity objects.
60 Object
visibility: 0 = visible, 1 = invisible (optional).
62 Color
index (if not BYLAYER). Zero indicates the BYBLOCK (floating) color 256
indicates the BYLAYER color Not output for nonentity objects.
67 Absent
or 0 indicates that the entity is in model space. One indicates that the entity
is in paper space. Other values are reserved.
The following table shows the group code that is output only if an extension dictionary is created for an object.
Overall
object (or entity) structure
Group code Description
102 {ACAD_XDICTIONARY
330 Extension
dictionary handle(s)
102 }
The following table shows the group that is output only if persistent reactors have been attached to an object or entity.
Overall
object (or entity) structure
Group code Description
102 {ACAD_REACTORS
330 Reactor
handle(s)
102 }
(after the last reactor handle)
The remaining common entity fields for entity objects follow, including the new 48 and 60 group codes.
Finally, extended data, whose presence is conditional on applications having attached it, begins with 1000 group codes. The extended data section has no explicit terminator, but the first 0 group code of the next entity or object section, or EOF, always indicates the end of the object record.
File Sections
The DXF file is subdivided into seven sections, plus the EOF marker. File separator groups are used to delimit these file sections.
HEADER Section
CLASSES Section
TABLES Section
BLOCKS Section
ENTITIES Section
OBJECTS Section
HEADER Section
The HEADER section of the DXF file contains settings of variables associated with the drawing. Each variable is specified in the header section by a 9 group giving the variable's name, followed by groups that supply the variable's value. Note that some variables appearing in appendix A of the AutoCAD Command Reference do not appear in the DXF file
DXF system
variables
Variable Type Description
$ACADVER 1 The
AutoCAD drawing database version number: AC1006 = R10, AC1009 = R11 and R12,
AC1011 in R13
$ANGBASE 50 Angle 0 direction
$ANGDIR 70 1 = clockwise angles, 0 =
counterclockwise
$ATTDIA 70 Attribute entry dialogs: 1 =
on, 0 = off
$ATTMODE 70 Attribute visibility: 0 =
none, 1 = normal, 2 = all
$ATTREQ 70 Attribute prompting during
INSERT: 1 = on, 0 = off
$AUNITS 70 Units format for angles
$AUPREC 70 Units precision for angles
$BLIPMODE 70 Blip mode on if nonzero
$CECOLOR 62 Current entity color number:
0 = BYBLOCK, 256 = BYLAYER
$CELTSCALE 40 Current entity linetype scale
$CELTYPE 6 Entity
linetype name, or BYBLOCK or BYLAYER
$CHAMFERA 40 First chamfer distance
$CHAMFERB 40 Second chamfer distance
$CLAYER 8 Current
layer name
$CMLJUST 70 Current multiline
justification: 0 = Top,1 = Middle, 2 = Bottom
$CMLSCALE 40 Current multiline scale
$CMLSTYLE 7 Current
multiline style name
$COORDS 70 0 = static coordinate
display, 1 = continuous update, 2 = d<a format
$DELOBJ 70 Controls object deletion: 0 =
deleted, 1 = retained
$DIMALT 70 Alternate unit dimensioning
performed if nonzero
$DIMALTD 70 Alternate unit decimal places
$DIMALTF 40 Alternate unit scale factor
$DIMALTTD 70 Number of decimal places for
tolerance values of an alternate units dimension.
$DIMALTTZ 70 Toggles suppression of zeros
for tolerance values: 0 = zeros not suppressed, 1 = zeros suppressed
$DIMALTU 70 Units format for alternate
units of all dimension style family members except angular: 1 = Scientific, 2 = Decimal, 3 = Engineering,
4 = Architectural
$DIMALTZ 70 Toggles suppression of zeros
for alternate unit dimension values: 0 = zeros not suppressed, 1 = zeros
suppressed
$DIMAPOST 1 Alternate
dimensioning suffix
$DIMASO 70 1 = create associative
dimensioning, 0 = draw individual entities
$DIMASZ 40 Dimensioning arrow size
$DIMAUNIT 70 Angle format for angular
dimensions: 0 = Decimal degrees, 1 =
Degrees/minutes/seconds, 2 = Gradians, 3 = Radians, 4 = Surveyor's units
$DIMBLK 2 Arrow
block name
$DIMBLK1 1 First
arrow block name
$DIMBLK2 1 Second
arrow block name
$DIMCEN 40 Size of center mark/lines
$DIMCLRD 70 Dimension line color: range
is 0 = BYBLOCK, 256 = BYLAYER
$DIMCLRE 70 Dimension extension line
color: range is 0 = BYBLOCK, 256 = BYLAYER
$DIMCLRT 70 Dimension text color: range is 0 = BYBLOCK, 256 = BYLAYER
$DIMDEC 70 Number of decimal places for
the tolerance values of a primary units dimension
$DIMDLE 40 Dimension line extension
$DIMDLI 40 Dimension line increment
$DIMEXE 40 Extension line extension
$DIMEXO 40 Extension line offset
$DIMLFAC 40 Linear measurements scale
factor
$DIMFIT 70 Placement of text and
arrowheads; Possible values: 0 through 3 (see appendix A, "System
Variables," in the AutoCAD Command Reference)
$DIMGAP 40 Dimension line gap
$DIMJUST 70 Horizontal dimension text
position:
0 = above dimension line and center-justified between extension lines,
1 = above dimension line and next to first extension line,
2 = above dimension line and next to second extension line,
3 = above and center-justified to first extension line,
4 = above and center-justified to second extension line
$DIMLIM 70 Dimension limits generated if
nonzero
$DIMPOST 1 General
dimensioning suffix
$DIMRND 40 Rounding value for dimension
distances
$DIMSAH 70 Use separate arrow blocks if
nonzero
$DIMSCALE 40 Overall dimensioning scale
factor
$DIMSD1 70 Suppression of first
extension line: 0 = not suppressed, 1 = suppressed
$DIMSD2 70 Suppression of second
extension line: 0 = not suppressed, 1 = suppressed
$DIMSE1 70 First extension line
suppressed if nonzero
$DIMSE2 70 Second extension line
suppressed if nonzero
$DIMSHO 70 1 = Recompute dimensions
while dragging, 0 = drag original image
$DIMSOXD 70 Suppress outside-extensions
dimension lines if nonzero
$DIMSTYLE 2 Dimension
style name
$DIMTAD 70 Text above dimension line if
nonzero
$DIMTDEC 70 Number of decimal places to
display the tolerance values
$DIMTFAC 40 Dimension tolerance display
scale factor
$DIMTIH 70 Text inside horizontal if
nonzero
$DIMTIX 70 Force text inside extensions
if nonzero
$DIMTM 40 Minus tolerance
$DIMTOFL 70 If text outside extensions,
force line extensions between extensions if nonzero
$DIMTOH 70 Text outside horizontal if
nonzero
$DIMTOL 70 Dimension tolerances
generated if nonzero
$DIMTOLJ 70 Vertical justification for
tolerance values: 0 = Top, 1 = Middle, 2 = Bottom
$DIMTP 40 Plus tolerance
$DIMTSZ 40 Dimensioning tick size: 0 = no ticks
$DIMTVP 40 Text vertical position
$DIMTXSTY 70 Dimension text style
$DIMTXT 40 Dimensioning text height
$DIMTZIN 70 Suppression of zeros for
tolerance values: 0 = not suppressed, 1 = suppressed
$DIMUNIT 70 Units format for all
dimension style family members except angular:
1 = Scientific, 2 = Decimal, 3 = Engineering, 4 = Architectural
$DIMUPT 70 Cursor functionality for user
positioned text:
0 = controls only the dimension line location,
1 = controls the text position as well as the dimension line location
$DIMZIN 70 Zero suppression for
"feet & inch" dimensions
$DISPSILH 70
Controls the display of
silhouette curves of body objects in wireframe mode: 0 = Off, 1 = On
$DWGCODEPAGE 3 Drawing
code page; Set to the system code page when a new drawing is created, but not
otherwise maintained by AutoCAD
$DRAGMODE 70 0 = off, 1 = on, 2 = auto
$ELEVATION 40 Current elevation set by ELEV
command
$EXTMAX 10,20,30 X, Y, and Z drawing extents upper-right
corner (in WCS)
$EXTMIN 10,20,30 X, Y, and Z drawing extents lower-left
corner (in WCS)
$FILLETRAD 40 Fillet radius
$FILLMODE 70 Fill mode on if nonzero
$HANDSEED 5 Next
available handle
$INSBASE 10,20,30 Insertion base set by BASE command (in
WCS)
$LIMCHECK 70 Nonzero if limits checking is
on
$LIMMAX 10,20 XY drawing limits
upper-right corner (in WCS)
$LIMMIN 10,20 XY drawing limits
lower-left corner (in WCS)
$LTSCALE 40 Global linetype scale
$LUNITS 70 Units format for coordinates
and distances
$LUPREC 70 Units precision for
coordinates and distances
$MAXACTVP 70 Sets maximum number of
viewports to be regenerated
$MENU 1 Name
of menu file
$MIRRTEXT 70 Mirror text if nonzero
$ORTHOMODE 70 Ortho mode on if nonzero
$OSMODE 70 Running object snap modes
$PDMODE 70 Point display mode
$PDSIZE 40 Point display size
$PELEVATION 40 Current paper space elevation
$PEXTMAX 10,20,30 Maximum X, Y, and Z
extents for paper space
$PEXTMIN 10,20,30 Minimum X, Y, and Z
extents for paper space
$PLIMCHECK 70 Limits checking in paper
space when nonzero
$PLIMMAX 10,20 Maximum X and Y
limits in paper space
$PLIMMIN 10,20 Minimum X and Y
limits in paper space
$PICKSTYLE 70 Controls group selection and
associative hatch selection:
0 = No group selection or associative hatch selection,
1 = Group selection,
2 = Associative hatch selection,
3 = Group selection and associative hatch selection
$PLINEGEN 70 Governs the generation of
linetype patterns around the vertices of a 2D polyline:
1
= linetype is generated in a continuous pattern around vertices of the
polyline,
0
= each segment of the polyline starts and ends with a dash
$PLINEWID 40 Default polyline width
$PSLTSCALE 70 Controls paper space linetype
scaling:
1
= no special linetype scaling
0
= viewport scaling governs linetype scaling
$PUCSNAME 2 Current
paper space UCS name
$PUCSORG 10,20,30 Current paper space UCS origin
$PUCSXDIR 10,20,30 Current paper space UCS X axis
$PUCSYDIR 10,20,30 Current paper space UCS Y axis
$QTEXTMODE 70 Quick text mode on if nonzero
$REGENMODE 70 REGENAUTO mode on if nonzero
$SHADEDGE 70 0 = faces shaded, edges not
highlighted
1 = faces shaded, edges highlighted in black
2 = faces not filled, edges in entity color
3 = faces in entity color, edges in black
$SHADEDIF 70 Percent ambient/diffuse
light, range 1 -100, default 70
$SKETCHINC 40 Sketch record increment
$SKPOLY 70 0 = sketch lines, 1 = sketch
polylines
$SPLFRAME 70 Spline control polygon
display: 1 = on, 0 = off
$SPLINESEGS 70 Number of line segments per
spline patch
$SPLINETYPE 70 Spline curve type for PEDIT
Spline
$SURFTAB1 70 Number of mesh tabulations in
first direction
$SURFTAB2 70 Number of mesh tabulations in
second direction
$SURFTYPE 70 Surface type for PEDIT Smooth
$SURFU 70 Surface density (for PEDIT
Smooth) in M direction
$SURFV 70 Surface density (for PEDIT
Smooth) in N direction
$TDCREATE 40 Date/time of drawing creation
$TDINDWG 40 Cumulative editing time for
this drawing
$TDUPDATE 40 Date/time of last drawing
update
$TDUSRTIMER 40 User elapsed timer
$TEXTSIZE 40 Default text height
$TEXTSTYLE 7 Current
text style name
$THICKNESS 40 Current thickness set by ELEV
command
$TILEMODE 70 1 for previous release
compatibility mode, 0 otherwise
$TRACEWID 40 Default trace width
$UCSNAME 2 Name
of current UCS
$UCSORG 10,20,30 Origin of current UCS (in WCS)
$UCSXDIR 10,20,30 Direction of current UCS's X axis
(in WCS)
$UCSYDIR 10,20,30 Direction of current UCS's Y axis
(in WCS)
$UNITMODE 70 Low bit set = display
fractions, feet-and-inches, and surveyor's angles in input format
$USERI1 - 5 70 Five integer variables
intended for use by third-party developers
$USERR1 - 5 40 Five real variables intended
for use by third-party developers
$USRTIMER 70 0 = timer off, 1 = timer on
$VISRETAIN 70 0 = don't retain
xref-dependent visibility settings,
1 = retain xref-dependent visibility settings
$WORLDVIEW 70 1 = set UCS to WCS during
DVIEW/VPOINT, 0 = don't change UCS
The following header variables existed prior to AutoCAD Release 11 but now have independent settings for each active viewport. DXFIN honors these variables when read from DXF files, but if a VPORT symbol table with *ACTIVE entries is present (as is true for any DXF file produced by Release 11 or higher), the values in the VPORT table entries override the values of these header variables.
Revised VPORT
header variables
Variable Group
code General description
$FASTZOOM 70 Fast zoom enabled if nonzero
$GRIDMODE 70 Grid mode on if nonzero
$GRIDUNIT 10,20 Grid X and Y spacing
$SNAPANG 50 Snap grid rotation angle
$SNAPBASE 10,
20 Snap/grid base point (in
UCS)
$SNAPISOPAIR 70 Isometric plane: 0 = left, 1
= top, 2 = right
$SNAPMODE 70 Snap mode on if nonzero
$SNAPSTYLE 70 Snap style: 0 = standard, 1 =
isometric
$SNAPUNIT 10,20 Snap grid X and Y spacing
$VIEWCTR 10,20 XY center of current view on
screen
$VIEWDIR 10,20,30 Viewing direction (direction from
target, in WCS)
$VIEWSIZE 40 Height of view
The
date/time variables ($TDCREATE and $TDUPDATE) are output as real numbers in the following
format:
<Julian
date>.<Fraction>
The elapsed time variables ($TDINDWG and $TDUSRTIMER)
have a similar format:
<Number
of days>.<Fraction>
The date and time variables are described in the AutoCAD Command Reference.
CLASSES Section
The classes section holds the information for application-defined classes whose instances appear in the BLOCKS, ENTITIES, and OBJECTS sections of the database. It is assumed that a class definition is permanently fixed in class hierarchy.
All fields are required.
Each entry in the CLASS section contains the group described in the following table.
CLASSES
section group codes
Code Group
value Description
0 <Class
DXF name> Identifies
beginning of records in BLOCKS, ENTITIES, and OBJECTS sections. If two object
types claim the same DXF name, AutoCAD appends unique numeric suffixes to them
until they are distinct within the drawing.
1 <C++
Class name> Used to bind
with software that defines object class behavior. These are always unique. Note
that the same C++ class may have slightly different DXF names in different
drawings.
2 <Application
name> Posted in Alert box
when a class definition listed in this section is not currently loaded.
90 <Class
version number> Set to version of
class that was loaded with instances of this class were last stored.
280 <was-a-zombie
flag> Set to 1 if class was not
loaded when this DXF file was created, and 0 otherwise.
281 <is-an-entity
flag> Set to 1 if class
was derived from the AcDbEntity class and can reside in the BLOCKS or ENTITIES
section. If 0, instances may appear only in the OBJECTS section.
TABLES Section
The TABLES section contains several tables, each of which can contain a variable number of entries.
The order of the tables may change, but the LTYPE table always precedes the LAYER table. Each table is introduced with a 0 group with the label TABLE. This is followed by a 2 group identifying the particular table (APPID, DIMSTYLE, LAYER, LTYPE, STYLE, UCS, VIEW, VPORT, or BLOCK_RECORD ), a 5 group (a handle), a group 100 (AcDbSymbolTable subclass marker), and a 70 group that specifies the maximum number of table entries that may follow. Table names are output in uppercase characters. The DIMSTYLE handle is a 105 group, not a 5 group.
The tables in a drawing can contain deleted items, but these are not written to the DXF file. Thus, fewer table entries may follow the table header than are indicated by the 70 group, so do not use the count in the 70 group as an index to read in the table. This group is provided so that a program that reads DXF files can allocate an array large enough to hold all the table entries that follow.
Following this header for each table are the table entries. Each table item consists of a 0 group identifying the item type (same as table name, such as LTYPE or LAYER), a 2 group giving the name of the table entry, a 70 group specifying flags relevant to the table entry (defined for each following table), and additional groups that give the value of the table entry. The end of each table is indicated by a 0 group with the value ENDTAB.
Both symbol table records and symbol tables are database objects. At a very minimum, with all prevailing usage within AutoCAD, this implies that a handle is present, positioned after the 2 group codes for both the symbol table record objects and the symbol table objects.
The DIMSTYLE table is the only record type in the system with a handle code of 105 because of its earlier usage of group code 5. As a rule, programmers should not be concerned about this exception unless it is in the context of the DIMSTYLE table section. This is the only context in which this exception should occur.
Common 70 group flag bit-coded values are described in the following table. Additional 70 group values that apply to LAYER, STYLE, and VIEW table entries are described in the subsequent tables.
APPID Group Codes
BLOCK_RECORD Group Codes
DIMSTYLE Group Codes
LAYER Group Codes
LTYPE Group Codes
STYLE Group Codes
UCS Group Codes
VIEW Group Codes
VPORT Group Codes
Symbol Table Example
Group 70 codes for
TABLE entries
Group 70 bit
codes that apply to all table entries
Bit-coded Description
value
16 If
set, table entry is externally dependent on an xref.
32 If
this bit and bit 16 are both set, the externally dependent xref has been
successfully resolved.
64 If
set, the table entry was referenced by at least one entity in the drawing the
last time the drawing was edited. (This flag is for the benefit of AutoCAD
commands; it can be ignored by most programs that read DXF files, and need not
be set by programs that write DXF files.)
The following tables indicate the group codes for each type of table item. All groups must be present for each table item.
APPID Group Codes
APPID table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbRegAppTableRecord)
2 User-supplied
application name; these table entries maintain a set of names for all
registered applications
70 Standard
flag values
BLOCK_RECORD Group
Codes
BLOCK_RECORD table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbBlockTableRecord)
2 Block
name
DIMSTYLE Group Codes
The DIMSTYLE table system variables are described in appendix A, "System Variables," in the AutoCAD Command Reference.
DIMSTYLE
table group codes
Group codes Description
105 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbDimStyleTableRecord)
2 Dimension
style name
70 Standard
flag values
3 DIMPOST
4 DIMAPOST
5 DIMBLK
6 DIMBLK1
7 DIMBLK2
40 DIMSCALE
41 DIMASZ
42 DIMEXO
43 DIMDLI
44 DIMEXE
45 DIMRND
46 DIMDLE
47 DIMTP
48 DIMTM
140 DIMTXT
141 DIMCEN
142 DIMTSZ
143 DIMALTF
144 DIMLFAC
145 DIMTVP
146 DIMTFAC
147 DIMGAP
71 DIMTOL
72 DIMLIM
73 DIMTIH
74 DIMTOH
75 DIMSE1
76 DIMSE2
77 DIMTAD
78 DIMZIN
170 DIMALT
171 DIMALTD
172 DIMTOFL
173 DIMSAH
174 DIMTIX
175 DIMSOXD
176 DIMDLRD
177 DIMCLRE
178 DIMCLRT
270 DIMUNIT
271 DIMDEC
272 DIMTDEC
273 DIMALTU
274 DIMALTTD
340 Handle
of referenced STYLE object (used instead of storing DIMTXSTY value)
275 DIMAUNIT
280 DIMJUST
281 DIMSD1
282 DIMSD2
283 DIMTOLJ
284 DIMTZIN
285 DIMALTZ
286 DIMALTTZ
287 DIMFIT
288 DIMUPT
LAYER Group Codes
LAYER table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbLayerTableRecord)
2 Layer
name
70 Standard
flags. In addition to the standard flags, the following values apply to
layers (bit-coded values):
1 = Layer is frozen. If not set, layer is thawed
2 = Layer is frozen by default in new viewports
4 = Layer is locked
62 Color
number (if negative, layer is Off)
6 Linetype
name
Xref-dependent layers are output during DXFOUT. For these layers, the associated linetype name in the DXF file is always CONTINUOUS.
LTYPE Group Codes
LTYPE table
group codes
Group codes Description
5 Handle.
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbLinetypeTableRecord)
2 Linetype
name.
70 Standard
flags
3 Descriptive
text for linetype.
72 Alignment
code; value is always 65, the ASCII code for A.
73 The
number of linetype elements.
40 Total
pattern length.
49 Dash,
dot or space length (one entry per element).
74 Complex
linetype element type (one per element):
0 = not complex,
2 = embeded text string,
4 = embeded shape
75 Complex
shape code (one per element if code 74 > 0)
1 if code 74 = 2
<shape_number> if code 74 = 4
340 Pointer
to STYLE object (one per element if code 74 > 0)
46 S=
scale value (optional). Multiple entries can exist.
50 R=
rotation value (optional). Multiple entries can exist.
44 X=
x offset value (optional). Multiple entries can exist.
45 Y=
y offset value (optional). Multiple entries can exist.
9 Text
string (one per element if code 74 = 2)
STYLE Group Codes
STYLE table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbTextStyleTableRecord)
2 Style
name
70 Standard
flag values (bit-coded values)
1 = if set, this entry describes a shape
4 = Vertical text
40 Fixed
text height; 0 if not fixed
41 Width
factor
50 Oblique
angle
71 Text
generation flags
2 = Text is backward (mirrored in X)
4=Text is
upside down (mirrored in Y)
42 Last height used
3 Primary font file name
4 Bigfont file name; blank if none
A STYLE table item is also used to record
shape file LOAD command requests. In this case the first bit (1) is set in the
70 group flags and only the 3 group (shape file name) is meaningful (all the
other groups are output, however).
UCS Group Codes
UCS table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbUCSTableRecord)
2 UCS
name
70 Standard
flag values
10 DXF:
X value of origin (in WCS).
Application: Origin (in WCS)
20, 30 DXF
only: Y and Z values of origin (in WCS)
11 DXF:
X value of X-axis direction (in WCS)
Application: X-axis direction (in WCS)
21, 31 DXF
only: Y and Z values of X-axis direction (in WCS)
12 DXF:
X value of Y-axis direction (in WCS)
Application: Y-axis direction (in WCS)
22, 32 DXF
only: Y and Z values of Y-axis direction (in WCS)
VIEW Group Codes
VIEW table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbViewTableRecord)
2 View
name
70 Standard
flag values (bit-coded values)
1=if set, this is a paper space view
40 View
height (in DCS)
10, 20 View
center point (in DCS)
41 View
width (in DCS)
11 DXF:
X value of view direction from target (in WCS) Application: View direction from target (in
WCS)
21, 31 DXF
only: Y and Z values of view direction from target (in WCS)
12 DXF:
X value of target point (in WCS)
Application: Target point (in WCS)
22, 32 DXF
only: Y and Z values of target point (in WCS)
42 Lens
length
43 Front
clipping plane (offset from target point)
44 Back
clipping plane (offset from target point)
50 Twist
angle
71 View
mode (see VIEWMODE system variable)
VPORT
Group Codes
VPORT table group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbSymbolTableRecord)
100 Subclass
marker (AcDbViewportTableRecord)
2 Viewport
name
70 Standard
flag values
10 DXF:
X value of lower-left corner of viewport
Application: Lower-left corner of viewport
20 DXF
only: Y value of lower-left corner of viewport
11 DXF:
X value of upper-right corner of viewport Application: Upper-right corner of viewport
21 DXF
only: Y value of upper-right corner of viewport
12 DXF:
X value of view center point (in DCS)
Application: View center point (in DCS)
22 DXF
only: Y value of view center point (in DCS)
13 DXF:
X value of snap base point
Application: Snap base point
23 DXF
only: Y value of snap base point
14 DXF:
X value of snap spacing
Application: Snap spacing X and Y
24 DXF
only: Y value of snap spacing
15 DXF:
X value of grid spacing
Application: Grid spacing X and Y
25 DXF
only: Y value of grid spacing
16 DXF:
X value of view direction from target point (in WCS) Application: View direction from target
point (in WCS)
26, 36 DXF
only: Y and Z values of view direction from target point (in WCS)
17 DXF:
X value of view target point (in WCS)
Application: View target point (in WCS)
27, 37 DXF
only: Y and Z values of view target point (in WCS)
40 View
height
41 Viewport
aspect ratio
42 Lens
length
43 Front
clipping plane (offset from target point)
44 Back
clipping plane (offset from target point)
50 Snap
rotation angle
51 View
twist angle
68 Status
field (never saved in DXF file)
69 ID
(never saved in DXF file)
71 View
mode (see VIEWMODE system variable)
72 Circle
zoom percent
73 Fast
zoom setting
74 UCSICON
setting
75 Snap
on/off
76 Grid
on/off
77 Snap
style
78 Snap
isopair
The VPORT table is unique in that it may contain several entries with the same name (indicating a multiple-viewport configuration). The entries corresponding to the active viewport configuration all have the name *ACTIVE. The first such entry describes the current viewport.
Symbol Table Example
This DXF sequence represents three full objects: the symbol table itself plus two entries.
0
TABLE It's a table, but what kind?
2
STYLE This kind. Exception to rule that code 0
fully defines type.
5
1C STYLE table handle; same as
for entities and other objects.
70
3 Maximum number of STYLE
table records to follow (pre-R13 field).
1001
APP_X APP_X has put xdata on a
symbol table.
1040
42.0 Just a single floating-point
number.
0
STYLE Beginning of first element
in the STYLE symbol table.
5
3A The first entry's handle.
(DIMSTYLE entries will have 105 here)
2
ENTRY_1 The first entry's text name.
70
64 Standard flag values.
40
.4 Text height.
41
1.0 Width scale factor.
50
0.0 Oblique angle.
71
0 Text generation flags.
42
0.4 Last height used.
3
BUFONTS.TXT Primary font file name.
0
STYLE Second entry begins. No
xdata or persistent reactors on first entry.
5
C2 Second entry handle.
2
ENTRY_2 Second entry text name.
...
... Other fields down to group
code 3.
3
BUFONTS.TXT Primary font file name and
last object type--specific group.
102
{ACAD_REACTORS This entry has a couple of
persistent reactors.
330
3C2 Soft ID to first reactor
object.
330
41B Soft ID to first reactor
object.
102
} Indicates the end of the
reactor set.
1001
APP_1 Xdata attached to this
entry.
1070
45
1001
APP_2
1004
18A5B3EF2C199A
0
UCS Start of UCS table (and end
of previous record and table).
BLOCKS Section
The BLOCKS section of the DXF file contains all the block definitions. It contains the entities that make up the blocks used in the drawing, including anonymous blocks generated by the HATCH command and by associative dimensioning. The format of the entities in this section is identical to those in the ENTITIES section. All entities in the BLOCKS section appear between block and endblk entities. Block and endblk entities appear only in the BLOCKS section. Block definitions are never nested (that is, no block or endblk entity ever appears within another block-endblk pair), although a block definition can contain an insert entity.
External references are written in the DXF file as any block definition, except that they also include a text string (group code 1) of the path and file name of the external reference.
The block table handle along with any xdata and persistent reactors will appear in each block definition immediately following the BLOCK record, which contains all of the specific information that a block table record stores. Therefore, each block definition has the following sequence of records:
BLOCK
<entities in block definitions>
ENDBLK
BLOCK group codes
BLOCK group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbEntity)
8 Layer
name (fixed)
100 Subclass
marker (AcDbBlockBegin)
2 Block
name
70 Block-type
bit-coded flags
1 = This is an anonymous block generated by hatching, associative dimensioning,
other internal operations, or an application
2 = This block has attribute definitions
4 = This block is an external reference (xref)
8 = Not used
16 = This block is externally dependent
32 = This is a resolved external reference, or dependent of an external
reference
64 = This definition is referenced
10 DXF:
X value of block base point
Application: Block base point
20, 30 DXF
only: Y and Z values of block base point
3 Block
name
1 Xref
path name (if the block is an xref) (optional)
*MODEL_SPACE and *PAPER_SPACE Block Definition
Now, there is always two extra, empty definitions in the BLOCKS section, titled *MODEL_SPACE and *PAPER_SPACE. These definitions manifest the new representation of model space and paper space as block definitions internally. The entities contained in these definitions will still appear in the ENTITIES section for compatibility.
Model Space and Paper Space Entity Segregation
The interleaving between model space and paper space will no longer occur, because of internal organization. Instead, all paper space entities will be output, followed by model space entities. The flag distinguishing them is the group code 67.
ENDBLK group codes
ENDBLK group codes
Group codes Description
5 Handle
100 Subclass
marker (AcDbEntity)
8 Layer
name (fixed)
100 Subclass
marker (AcDbBlockEnd)
ENTITIES Section
The groups that make up an entity item are described in this section. Many of the entities include "flag" groups. These are integer codes (6x or 7x groups) that encode information specific to the particular entity type. Any bits not defined here can be ignored in these fields and set to 0 when constructing a DXF file.
Although any entity or object definition can have extended data (xdata) following the regular definition data, the entities that AutoCAD regularly attaches xdata to are noted following the table of definition data.
Common Entity Group Codes
3DFACE Group Codes
3DSOLID Group Codes
ARC Group Codes
ATTDEF Group Codes
ATTRIB Group Codes
BODY Group Codes
CIRCLE Group Codes
DIMENSION Group Codes
ELLIPSE Group Codes
INSERT Group Codes
LEADER Group Codes
LINE Group Codes
MLINE Group Codes
MTEXT Group Codes
OLEFRAME Group Codes
POINT Group Codes
POLYLINE Group Codes
RAY Group Codes
REGION Group Codes
SEQEND Group Codes
SHAPE Group Codes
SOLID Group Codes
SPLINE Group Codes
TEXT Group Codes
TOLERANCE Group Codes
TRACE Group Codes
VERTEX Group Codes
VIEWPORT Group Codes
XLINE Group Codes
Common Entity Group
Codes
The following table shows group codes that apply to virtually all entities. Some of the group codes are included with an entity only if the entity has nondefault values for these properties. When a group is omitted, its default value upon input (when using DXFIN) is indicated in the third column. If the value of a group code is equal to the default, it is omitted upon output (when using DXFOUT).
Group codes
common to all entities
Group code |
Description |
if omitted, defaults to |
-1 |
Application only: Entity
name (changes each time the drawing is opened). |
Not omitted |
0 |
Entity type. |
Not omitted |
5 |
Handle |
Not omitted |
100 |
Subclass marker
(AcDbEntity) |
Not omitted |
67 |
Absent or 0 indicates that
the entity is in model space. One indicates that the entity is in paper
space. Other values are reserved.
(optional) |
0 |
8 |
Layer name |
Not omitted |
6 |
Linetype name (if not
BYLAYER). The special name BYBLOCK indicates a floating linetype. (optional) |
BYLAYER |
62 |
Color number (if not
BYLAYER). Zero indicates the BYBLOCK (floating) color. 256 indicates the
BYLAYER color. (optional). |
BYLAYER |
48 |
Linetype scale. (optional) |
1.0 |
60 |
Object visibility: 0 =
visible, 1 = invisible (optional). |
1.0 |
3DFACE Group Codes
3DFACE group codes
Group codes Description
100 Subclass
marker (AcDbFace)
10 DXF:
X value of first corner (in WCS)
Application: First corner (in WCS)
20, 30 DXF
only: Y and Z values of first corner (in WCS)
11 DXF:
X value of second corner (in WCS)
Application: Second corner (in WCS)
21, 31 DXF
only: Y and Z values of second corner (in WCS)
12 DXF:
X value of third corner (in WCS)
Application: Third corner (in WCS)
22, 32 DXF
only: Y and Z values of third corner (in WCS)
13 DXF:
X value of fourth corner
Application: Fourth corner
(if only three corners are entered, this is the same as the third corner) (in
WCS)
23, 33 DXF
only: Y and Z values of fourth corner
70 Invisible
edge flags (optional; default = 0):
1 = First edge is invisible
2 = Second edge is invisible
4 = Third edge is invisible
8 = Fourth edge is invisible
3DSOLID Group Codes
3DSOLID group codes
Group codes Description
100 Subclass
marker (AcDbModelerGeometry)
70
1 Proprietary
data (multiple lines < 255 characters each)
3 Additional
lines of proprietary data (if previous group 1 string is greater than 255
characters)
ARC Group Codes
See
ELLIPSE for information regarding elliptical arcs.
ARC group codes
Group codes Description
100 Subclass
marker (AcDbCircle)
39 Thickness
(optional; default = 0)
10 DXF:
X value of center point (in OCS)
Application: Center point (in OCS)
20, 30 DXF
only: Y and Z values of center point (in OCS)
40 Radius
100 Subclass
marker (AcDbArc)
50 Start
angle
51 End
angle
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
ATTDEF Group Codes
ATTDEF group codes
Group codes Description
100 Subclass
marker (AcDbText)
39 Thickness
(optional; default = 0)
10 DXF:
X value of text start point (in OCS)
Application: Text start point (in OCS)
20, 30 DXF
only: Y and Z values of text start point (in OCS)
40 Text
height
1 Default
value (string). See ASCII Control Characters
100 Subclass
marker (AcDbAttributeDefinition)
3 Prompt
string
2 Tag
string
70 Attribute
flags
1 = Attribute is invisible (does not appear)
2 = This is a constant attribute
4 = Verification is required on input of this attribute
8 = Attribute is preset (no prompt during insertion)
73 Field
length (optional; default = 0) (not currently used)
50 Text
rotation (optional; default = 0)
41 Relative
X scale factor (optional; default = 1)
51 Oblique
angle (optional; default = 0)
7 Text
style name (optional, default = STANDARD)
71 Text
generation flags (optional, default = 0). See TEXT
72 Horizontal
text justification type (optional, default = 0). See TEXT
74 Vertical
text justification type (optional, default = 0). See group code 73 in TEXT
11, 21, 31 Alignment
point (optional; appears only if 72 or 74 group is present and nonzero) (in
OCS)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
ATTRIB Group Codes
ATTRIB group codes
Group codes Description
100 Subclass
marker (AcDbText)
39 Thickness
(optional; default = 0)
10 DXF:
X value of text start point (in OCS)
Application: Text start point (in OCS)
20, 30 DXF
only: Y and Z values of text start point (in OCS)
40 Text
height
1 Value
(string)
100 Subclass
marker (AcDbAttribute)
2 Attribute
tag (string)
70 Attribute
flags
1 = Attribute is invisible (does not appear)
2 = This is a constant attribute
4 = Verification is required on input of this attribute
8 = Attribute is preset (no prompt during insertion)
73 Field
length (optional; default = 0) (not currently used)
50 Text
rotation (optional; default = 0)
41 Relative
X-scale factor for fit-type text (optional; default=1)
51 Oblique
angle (optional; default = 0)
7 Text
style name (optional; default = STANDARD)
71 Text
generation flags (optional; default = 0); see TEXT
72 Horizontal
text justification type (optional; default = 0); see TEXT
74 Vertical
text justification type (optional; default = 0); see 73 group in TEXT
11, 21, 31 Alignment
point; appears only if 72 or 74 group is present and nonzero (in OCS)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
BODY Group Codes
BODY group codes
Group codes Description
100 Subclass
marker (AcDbModelerGeometry)
70
1 Proprietary
data (multiple lines < 255 characters each)
3 Additional
lines of proprietary data (if previous group 1 string is greater than 255
characters)
CIRCLE Group Codes
CIRCLE group codes
Group codes Description
100 Subclass
marker (AcDbCircle)
39 Thickness
(optional; default = 0)
10 DXF:
X value of center point (in OCS)
Application: Center point (in OCS)
20, 30 DXF
only: Y and Z values of center point (in OCS)
40 Radius
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
DIMENSION Group Codes
Group codes common to all dimension types
Group codes Description
100 Subclass
marker (AcDbDimension)
2 Name
of block containing the entities that make up the dimension picture.
10 DXF:
X value of definition point for all dimension types. (in WCS) Application: Definition point for all
dimension types. (in WCS)
20, 30 DXF
only: Y and Z values of definition point for all dimension types.
(in WCS)
11 DXF:
X value of middle point of dimension text. (in OCS) Application: Middle point of dimension text.
(in OCS)
21, 31 DXF
only: Y and Z values of middle point of dimension text. (in OCS)
70 Dimension
type.
0 = Rotated, horizontal, or vertical
1 = Aligned
2 = Angular
3 = Diameter
4 = Radius
5 = Angular 3-point
6 = Ordinate
64 = Ordinate type. This is a bit value (bit 7) used only with integer value 6.
If set (70), ordinate is X-type; if not set (6), ordinate is Y-type.
128 = This is a bit value (bit 8) added to the other group 70 values if the
dimension text has been positioned at a user-defined location rather than at
the default location.
1 Dimension
text explicitly entered by the user. Optional; default is the measurement. If
null or "<>", the dimension measurement is drawn as the
text, if " " (one blank space), the text is suppressed. Anything else
is drawn as the text.
53 The optional group code 53 is the rotation
angle of the dimension text away from its default orientation (the direction of
the dimension line).
51 All dimension types have an optional 51
group code, which indicates the horizontal direction for the dimension entity.
It determines the orientation of dimension text and lines for horizontal,
vertical, and rotated linear dimensions.
This group value is the negative of the angle between the OCS X-axis and the
UCS X axis. It is always in the XY plane of the OCS.
210 DXF: X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
3 Dimension
style name.
Group codes
for aligned, linear, and rotated dimensions
Group codes Description
100 Subclass
marker (AcDbAlignedDimension)
12 DXF:
X value of insertion point for clones of a dimension. (Baseline and
Continue) (in OCS) Application: Insertion
point for clones of a dimension. (Baseline and Continue) (in OCS)
22, 32 DXF
only: Y and Z values of insertion point for clones of a
dimension. (Baseline and Continue) (in OCS)
13 DXF:
X value of definition point for linear and angular dimensions. (in
WCS) Application: Definition point for
linear and angular dimensions. (in WCS)
23, 33 DXF
only: Y and Z values of definition point for linear and angular
dimensions. (in WCS)
14 DXF:
X value of definition point for linear and angular dimensions. (in
WCS) Application: Definition point for
linear and angular dimensions. (in WCS)
24, 34 DXF
only: Y and Z values of definition point for linear and angular
dimensions. (in WCS)
Image: Linear dimension
Group codes
for linear, and rotated dimensions
Group codes Description
50 Angle
of rotated, horizontal, or vertical dimensions.
52 Linear
dimension types with an oblique angle have an optional group code 52. When
added to the rotation angle of the linear dimension (group code 50), it gives
the angle of the extension lines.
100 Subclass
marker (AcDbRotatedDimension)
Group codes
for radial and diameter dimensions
Group codes Description
100 Subclass
marker (AcDbRadialDimension or AcDbDiametricDimension)
15 DXF:
X value of definition point for diameter, radius, and angular
dimensions. (in WCS) Application:
Definition point for diameter, radius, and angular dimensions. (in WCS)
25, 35 DXF
only: Y and Z values of definition point for diameter, radius,
and angular dimensions. (in WCS)
40 Leader
length for radius and diameter dimensions.
Image: Diameter dimension
Image: Radial dimension
Group codes
for angular dimensions
Group codes Description
100 Subclass
marker (AcDb3PointAngularDimension)
13 DXF:
X value of definition point for linear and angular dimensions. (in
WCS) Application: Definition point for
linear and angular dimensions. (in WCS)
23, 33 DXF
only: Y and Z values of definition point for linear and angular
dimensions. (in WCS)
14 DXF:
X value of definition point for linear and angular dimensions. (in
WCS) Application: Definition point for
linear and angular dimensions. (in WCS)
24, 34 DXF
only: Y and Z values of definition point for linear and angular
dimensions. (in WCS)
15 DXF:
X value of definition point for diameter, radius, and angular
dimensions. (in WCS) Application:
Definition point for diameter, radius, and angular dimensions. (in WCS)
25, 35 DXF
only: Y and Z values of definition point for diameter, radius,
and angular dimensions. (in WCS)
16 DXF:
X value of point defining dimension arc for angular dimensions. (in
OCS) Application: Point defining
dimension arc for angular dimensions. (in OCS)
26, 36 DXF
only: Y and Z values of point defining dimension arc for angular
dimensions. (in OCS)
Image: Angular dimension
Image: 3-Point angular dimension
Group codes
for ordinate dimensions
Group codes Description
100 Subclass
marker (AcDbOrdinateDimension)
13 DXF:
X value of definition point for linear and angular dimensions. (in
WCS) Application: Definition point for
linear and angular dimensions. (in WCS)
23, 33 DXF
only: Y and Z values of definition point for linear and angular
dimensions. (in WCS)
14 DXF:
X value of definition point for linear and angular dimensions. (in
WCS) Application: Definition point for
linear and angular dimensions. (in WCS)
24, 34 DXF
only: Y and Z values of definition point for linear and angular
dimensions. (in WCS)
Image: Ordinate dimension
Xdata belonging to the application ID "ACAD" may follow. This describes any dimension overrides that have been applied to this entity. See Dimension Style Overrides.
For all dimension types, the following group codes represent 3D WCS points: (10, 20, 30), (13, 23, 33), (14, 24, 34), and (15, 25, 35). For all dimension types, the following group codes represent 3D OCS points: (11, 21, 31), (12, 22, 32), and (16, 26, 36).
Dimension Style Overrides
Dimension style overrides can be applied to dimension, leader, and tolerance entities. Any overrides applied to these entities are stored in the entity as xdata. The overriden dimension variable group codes and the related values are contained within group 1002 control strings. The following example shows the xdata of a dimension entity where the DIMTOL and DIMCLRE variables have been overriden.
(setq
diment (car (entsel))) Select dimension entity
(setq
elst (entget diment '("ACAD")))
Get
entity definition list
(assoc
-3 elst) Extract xdata only
This code returns the following:
(-3 ("ACAD" (1000 . "DSTYLE")
(1002 . "{")(1070 . 177)(1070 . 3)
(1070 . 71)(1070 . 1)(1002 . "}")
))
Linear
dimensioning coordinate group codes
The point (13,23,33) specifies the start point of the first extension line and the point (14,24,34) specifies the start point of the second extension line. Point (10,20,30) specifies the dimension line location. The point (11,21,31) specifies the midpoint of the dimension text.
Angular dimensioning coordinate group codes
The points (13,23,33) and (14,24,34) specify the endpoints of the line used to determine the first extension line and points (10,20,30) and (15,25,35) specify the endpoints of the line used to determine the second extension line. Point (16,26,36) specifies the location of the dimension line arc. The point (11,21,31) specifies the midpoint of the dimension text.
Angular (3-point) dimensioning coordinate group codes
The point (15,25,35) specifies the vertex of the angle. The points (13,23,33) and (14,24,34) specify the endpoints of the extension lines. The point (10,20,30) specifies the location of the dimension line arc. The point (11,21,31) specifies the midpoint of the dimension text.
Diameter dimensioning coordinate group codes
The point (15,25,35) specifies the first point of the dimension line on the circle/arc and the point (10,20,30) specifies the point opposite the first point. The point (11,21,31) specifies the midpoint of the dimension text.
Radius dimensioning coordinate group codes
The point (15,25,35) specifies the first point of the dimension line on the circle/arc and the point (10,20,30) specifies the center of the circle/arc. The point (11,21,31) specifies the midpoint of the dimension text.
Ordinate dimensioning coordinate group codes
The point (13,23,33) specifies the feature location. The point (14,24,34) specifies the leader end point. The point (11,21,31) specifies the midpoint of the dimension text.
ELLIPSE Group Codes
ELLIPSE group codes
Group codes Description
100 Subclass
marker (AcDbEllipse)
10 DXF:
X value of center point (in WCS)
Application: Center point (in WCS)
20, 30 DXF
only: Y and Z values of center point (in WCS)
11 DXF:
X value of endpoint of major axis, relative to the center Application: Endpoint of major axis,
relative to the center
21, 31 DXF
only: Y and Z values of endpoint of major axis, relative to the
center
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
40 Length
of minor axis
41 Start
parameter (this value is 0.0 for a full ellipse)
42 End
parameter (this value is 2pi for a full elliipse)
INSERT Group Codes
INSERT group codes
Group codes Description
100 Subclass
marker (AcDbBlockReference)
66 Variable
attributes-follow flag (optional; default = 0); if the value of
attributes-follow flag is 1, a series of attribute entities is expected to
follow the insert, terminated by a seqend entity
2 Block
name
10 DXF:
X value of insertion point (in OCS)
Application: Insertion point (in OCS)
20, 30 DXF
only: Y and Z values of insertion point (in OCS)
41 X
scale factor (optional; default = 1)
42 Y
scale factor (optional; default = 1
43 Z
scale factor (optional; default = 1)
50 Rotation angle (optional; default = 0)
70 Column count (optional; default = 1)
71 Row count (optional; default = 1)
44 Column spacing (optional; default = 0)
45 Row spacing (optional; default = 0)
210 DXF: X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
Xdata belonging to the application ID "ACAD" may follow. This contains information related to hatch block properties.
LEADER Group Codes
LEADER group codes
Group Codes Description
100 Subclass
marker (AcDbLeader)
3 Dimension
style name
71 Arrowhead
flag: 0 = disabled1 = enabled
72 Leader
path type: 0 = Straight line segments1 = Spline
73 Leader
creation flag (default = 3):
0 = leader created with text annotation.
1 = created with Tolerance annotation
2 = created with Block Ref annotation
3 = created without any annotation
74 Hookline
direction flag:
0 = hookline (or end of tangent for a splined leader) is the opposite direction
from the horizontal vector.
1 = hookline (or end of tangent for a splined leader) is the same direction as
horizontal vector (see code 75).
75 Hookline
flag:
0 = no hookline
1 = has a hookline
40 Text
annotation height
41 Text
annotation width
76 Number
of vertices in leader (ignored for DXFIN)
10 DXF:
X value of vertex coordinates (one entry for each vertex) Application: Vertex coordinates (one entry for
each vertex
20, 30 DXF
only: Y and Z values of vertex coordinates (one entry for each
vertex)
77 Color
to use if leader's DIMCLRD=BYBLOCK
340 Hard
reference to associated mtext entity
210 DXF:
X value of normal vector
Application: Normal vector
220,230 DXF
only: Y and Z values of normal vector
211 DXF:
X value of "horizontal" direction for leader Application: "Horizontal"
direction for leader
221,231 DXF
only: Y and Z values of "horizontal" direction for
leader
212 DXF:
X value of direction of annotation offset from last leader vertex Application: Direction of annotation offset
from last leader vertex
222,232 DXF
only: Y and Z values of direction of annotation offset from last
leader vertex
Xdata belonging to the application ID "ACAD" may follow. This describes any dimension overrides that have been applied to this entity. See Dimension Style Overrides.
LINE Group Codes
LINE group codes
GroupCodes Description
100 Subclass
marker (AcDbLine)
39 Thickness
(optional; default = 0)
10 DXF:
X value of start point (in WCS)
Application: Start point (in WCS)
20, 30 DXF
only: Y and Z values of start point (in WCS)
11 DXF:
X value of end point (in WCS)
Application: End point (in WCS)
21, 31 DXF
only: Y and Z values of end point (in WCS)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
MLINE Group Codes
MLINE group codes
Group Codes Description
100 Subclass
marker (AcDbMline)
2 String
of up to 32 characters. The name of the style used for this mline. An entry for
this style must exist in the MLINESTYLE dictionary.
340 Pointer
handle/ID of MLINESTYLE dictionary
40 Scale
factor.
70 Justification:
0=top, 1=zero, 2=bottom
71 Open/closed
flag: 1=open, 3=closed
72 Number
of vertices
73 Number
of elements in MLINESTYLE defenition
10 DXF:
X value of mline start point Application:
Mline start point
20, 30 DXF
only: Y and Z values of mline start point
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
11 DXF:
X value of vertex coordinates (multiple entries; one entry for each
vertex) Application: Vertex coordinates (multiple
entries; one entry for each vertex
21, 31 DXF
only: Y and Z values of vertex coordinates (multiple entries; one
entry for each vertex)
12 DXF:
X value of direction vector of segment starting at this vertex (multiple entries; one for each vertex) Application: Direction vector of segment
starting at this vertex (multiple
entries; one for each vertex)
22, 32 DXF
only: Y and Z values of direction vector of segment starting at
this vertex (multiple entries; one for
each vertex)
13 DXF:
X value of direction vector of miter at this vertex (multiple entries; one for each vertex) Application: Direction vector of miter at
this vertex (multiple entries; one for
each vertex)
23, 33 DXF
only: Y and Z values of direction vector of miter at this
vertex (multiple entries; one for each
vertex)
74 Number
of parameters for this element (repeats for each element in segment)
41 Element
parameters (repeats based on previous code 74)
75 Number
of area fill parameters for this element (repeats for each element in segment)
42 Area
fill parameters (repeats based on previous code 75)
MTEXT Group Codes
MTEXT group codes
Group codes Description
100 Subclass
marker (AcDbMText)
10 DXF:
X value of insertion point
Application: Insertion point
20, 30 DXF
only: Y and Z values of insertion point
40 Default
text height
41 Reference
rectangle width.
71 Attachment
point:
1 = Top left 2 = Top
center
3 = Top right 4 = Middle
left
5 = Middle center 6 = Middle right
7 = Bottom left 8 = Bottom
center
9 = Bottom right
72 Drawing
direction:
1 = Left to right 2 = Right to
left
3 = Top to bottom 4 = Bottom to top
1 Text
string. If the text string is less than 255 characters, all characters appear
in group 1. If the text string is greater than 255 characters, the string is
divided into 255 character chunks, which appear in one or more group 3 codes.
If group 3 codes are used, the last group is a group 1 and has fewer than 255
characters.
3 Additional
text (always in 255 character chunks).
7 Text
style name (STANDARD if not provided).
210 DXF:
X value of normal vector
Application: Normal vector
220,230 DXF
only: Y and Z values of normal vector
11 DXF:
X value of X-axis direction vector (in WCS). Application: X-axis direction vector (in
WCS).
Note A group code 50 (rotation angle
in radians) passed as DXF input is converted to the equivalent direction vector
(if both a code 50 and codes 11,21,31 are passed, the last one wins). This is
provided as a convenience for conversions from text objects.
21,31 DXF
only: Y and Z values of X-axis direction vector (in WCS).
OLEFRAME Group Codes
OLEFRAME group codes
Group codes Description
100 Subclass
marker (AcDbOleFrame)
70
90
310 Binary
data (multiple lines)
1 End
of Ole data (the string "OLE")
POINT Group Codes
POINT group codes
Group codes Description
100 Subclass
marker (AcDbPoint)
10 DXF:
X value of point location (in WCS)
Application: Point location (in WCS)
20, 30 DXF
only: Y and Z values of point location (in WCS)
39 Thickness
(optional; default = 0)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
50 Angle
of the X axis for the UCS in effect when the point was drawn (optional, default
= 0); used when PDMODE is nonzero
POLYLINE Group Codes
POLYLINE group codes
Group codes Description
100 Subclass
marker (AcDb2dPolyline or AcDb3dPolyline)
66 Vertices-follow
flag (always 1 for a polyline)
10 DXF:
Always 0 Application: A
"dummy" point; the X and Y coordinates are always 0,
and the Z coordinate is the polyline's elevation (in OCS when 2D, WCS
when 3D)
20 DXF
only: Always 0
30 DXF
only: The polyline's elevation (in OCS when 2D, WCS when 3D)
39 Thickness
(optional; default = 0)
70 Polyline
flag (bit-coded); default is 0
1 = This is a closed polyline (or a polygon mesh closed in the M direction),
2 = Curve-fit vertices have been added,
4 = Spline-fit vertices have been added,
8 = This is a 3D polyline,
16 = This is a 3D polygon mesh,
32 = The polygon mesh is closed in the N direction,
64 = The polyline is a polyface mesh,
128 = The linetype pattern is generated continuously around the vertices of
this polyline
40 Default
starting width (optional; default = 0)
41 Default
ending width (optional; default = 0)
71 Polygon
mesh M vertex count (optional; default = 0)
72 Polygon
mesh N vertex count (optional; default = 0)
73 Smooth
surface M density (optional; default = 0)
74 Smooth
surface N density (optional; default = 0)
75 Curves
and smooth surface type (optional; default = 0); integer codes, not bit-coded
0 = No smooth surface fitted,
5 = Quadratic B-spline surface,
6 = Cubic B-spline surface,
8 = Bezier surface
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z axis
(optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
Xdata with the "AUTOCAD_POSTSCRIPT_FIGURE" application ID may follow. This contains information related to PostScript images and PostScript fill information.
A polyface mesh is represented in DXF as a variant of a polyline entity. The polyline header is identified as introducing a polyface mesh by the presence of the 64 bit in the polyline flags (70) group. The 71 group specifies the number of vertices in the mesh, and the 72 group specifies the number of faces. Although these counts are correct for all meshes created with the PFACE command, applications are not required to place correct values in these fields. Following the polyline header is a sequence of vertex entities that specify the vertex coordinates and faces that compose the mesh.
The AutoCAD entity structure imposes a limit on the number of vertices that a given face entity can specify. You can represent more complex polygons by decomposing them into triangular wedges. Their edges should be made invisible to prevent visible artifacts of this subdivision from being drawn. The PFACE command performs this subdivision automatically, but when applications generate polyface meshes directly, the applications must do this themselves.
The number of vertices per face is the key parameter in this subdivision process. The PFACEVMAX system variable provides an application with the number of vertices per face entity. This value is read-only and is set to 4.
Polyface meshes created with the PFACE command are always generated with all the vertex coordinate entities first, followed by the face definition entities. The code within AutoCAD that processes polyface meshes does not require this ordering. It works even with interleaved vertex coordinates and face definitions as long as no face specifies a vertex with an index that appears after it in the database. Programs that read polyface meshes from DXF should be tolerant of odd vertex and face ordering
RAY Group Codes
RAY group codes
Group codes Description
100 Subclass
marker (AcDbRay)
10 DXF:
X value of start point (in WCS)
Application: Start point (in WCS)
20, 30 DXF
only: Y and Z values of start point (in WCS)
11 DXF:
X value of unit direction vector (in WCS) Application: Unit direction vector (in WCS)
21, 31 DXF
only: Y and Z values of unit direction vector (in WCS)
REGION Group Codes
REGION group codes
Group Codes Description
100 Subclass
marker (AcDbModelerGeometry)
70
1 Proprietary
data (multiple lines < 255 characters each)
3 Additional
lines of proprietary data (if previous group 1 string is greater than 255
characters)
SEQEND Group Codes
SEQEND group codes
Group codes Description
-2 Application
only: Name of entity that began the sequence. This entity marks the end of
vertex (vertex type name) for a polyline, or the end of attribute entities
(attrib type name) for an insert entity that has attributes (indicated) by 66
group present and nonzero in insert entity).
This code is not saved in a DXF file.
SHAPE Group Codes
SHAPE group codes
Group codes Description
100 Subclass
marker (AcDbShape)
39 Thickness
(optional; default = 0)
10 DXF:
X value of insertion point
Application: Insertion point
20, 30 DXF
only: Y and Z values of insertion point
40 Size
2 Shape
name
50 Rotation
angle (optional; default = 0)
41 Relative
X scale factor (optional; default =1)
51 Oblique
angle (optional; default =0)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
SOLID Group Codes
SOLID group codes
Group codes Description
100 Subclass
marker (AcDbTrace)
10 DXF:
X value of first corner
Application: First corner
20, 30 DXF
only: Y and Z values of first corner
11 DXF:
X value of second corner
Application: Second corner
21, 31 DXF
only: Y and Z values of second corner
12 DXF:
X value of third corner
Application: Third corner
22, 32 DXF
only: Y and Z values of third corner
13 DXF:
X value of fourth corner
Application: Fourth corner.
If only three corners are entered to define the SOLID, then the fourth corner
coordinate is the same as the third
23, 33 DXF
only: Y and Z values of fourth corner.
39 Thickness
(optional; default = 0)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
SPLINE Group Codes
SPLINE group codes
Group codes Description
100 Subclass
marker (AcDbSpline)
210 DXF:
X value of normal vector
Application: Normal vector (omitted if the spline is nonplanar)
220, 230 DXF
only: Y and Z values of normal vector
70 Spline
flag (bit coded):
1 = Closed spline, 2 = Periodic
spline,
4 = Rational spline, 8 = Planar,
16 = Linear; planar bit is also set
71 Degree
of the spline curve
72 Number
of knots
73 Number
of control points
74 Number
of fit points (if any)
42 Fit
tolerance (default = 0.0000001)
43 Control-point
tolerance (default = 0.0000001)
44 Fit
tolerance (if a fit spline)
12 DXF:
X value of start tangent (may be omitted) (in WCS) Application: Start tangent (may be omitted)
(in WCS)
22, 32 DXF
only: Y and Z values of start tangent (may be omitted) (in WCS)
13 DXF:
X value of end tangent (may be omitted) (in WCS) Application: End tangent (may be omitted)
(in WCS)
23, 33 DXF
only: Y and Z values of end tangent (may be omitted) (in WCS)
40 Knot
value (one entry per knot)
10 DXF:
X value of control points (in WCS) (one entry per control point) Application: Control points (in WCS) (one
entry per control point)
20, 30 DXF
only: Y and Z values of control points (in WCS) (one entry per
control point)
41 Weight
(if not 1); with multiple group pairs, will be present if all are not 1
11 DXF:
X value of fit points (in WCS) (one entry per fit point) Application: Fit points (in WCS) (one entry
per fit point)
21, 31 DXF
only: Y and Z values of fit points (in WCS) (one entry per fit
point)
TEXT Group Codes
TEXT group codes
Group codes Description
100 Subclass
marker (AcDbText)
39 Thickness
(optional; default = 0).
10 DXF:
X value of insertion point. (in OCS)
Application: Insertion point. (in OCS)
20, 30 DXF
only: Y and Z values of insertion point. (in OCS)
40 Height.
1 Text
value (the string itself).
50 Rotation
angle (optional default=0).
41 Relative
X scale factor. For fit-type text. (optional; default=1.0)
51 Oblique
angle (optional; default = 0).
7 Text
style name (optional; default = STANDARD).
71 Text
generation flags:.
2 = Text is backward (mirrored in X),
4 = Text is
upside down (mirrored in Y)
72 Horizontal alignment (optional, default =
0); integer codes (not bit-coded)
0 = Left, 1=
Center,
2 = Right, 3 =
Aligned (if vertical alignment = 0),
4 = Middle (if vertical alignment = 0),
5 = Fit (if vertical alignment = 0)
See the following table for clarification.
73 Vertical alignment; default is 0; integer
codes (not bit-coded)
0 = Baseline, 1 = Bottom, 2 = Middle, 3 = Top
See the following table for clarification.
11 DXF: X value of alignment point. Application: Alignment point.
Present only if 72 or 73 group is present and nonzero; if the justification is
anything other than baseline/left (groups 72 and 73 both 0), group codes 11,
21, and 31 specify the alignment point (or the second alignment point for
Aligned or Fit). (in OCS)
21, 31 DXF
only: Y and Z values of alignment point.
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
100 Subclass
marker (AcDbText)
Group 72 and
73 integer codes
Group 73 Group
72 (horizontal alignment)
(vertical
alignment)
|
0 |
1 |
2 |
3 |
4 |
5 |
3
(top) |
TLeft |
TCenter |
TRight |
|
|
|
2
(middle) |
MLeft |
MCenter |
MRight |
|
|
|
1
(bottom) |
BLeft |
BCenter |
BRight |
|
|
|
0
(baseline) |
Left |
Center |
Right |
Aligned |
Middle |
Fit |
TOLERANCE Group Codes
TOLERANCE group codes
Group codes Description
100 Subclass
marker (AcDbFcf)
3 Dimension
style name
10 DXF:
X value of insertion point. (in WCS)
Application: Insertion point. (in WCS)
20, 30 DXF
only: Y and Z values of insertion point. (in WCS)
1 Primary
text value
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
11 DXF:
X value of X-axis direction vector (in WCS) Application: X-axis direction vector (in
WCS)
21, 31 DXF
only: Y and Z values of X-axis direction vector (in WCS)
Xdata belonging to the application ID "ACAD" may follow. This describes any dimension overrides that have been applied to this entity. See Dimension Style Overrides.
TRACE Group Codes
TRACE group codes
Group codes Description
100 Subclass
marker (AcDbTrace)
39 Thickness
(optional; default = 0)
10 DXF:
X value of first corner (in OCS)
Application: First corner (in OCS)
20, 30 DXF
only: Y and Z values of first corner (in OCS)
11 DXF:
X value of second corner (in OCS)
Application: Second corner (in OCS)
21, 31 DXF
only: Y and Z values of second corner (in OCS)
12 DXF:
X value of third corner (in OCS)
Application: Third corner (in OCS)
22, 32 DXF
only: Y and Z values of third corner (in OCS)
13 DXF:
X value of fourth corner (in OCS)
Application: Fourth corner (in OCS)
23, 33 DXF
only: Y and Z values of fourth corner (in OCS)
210 DXF:
X value of extrusion direction.
Application: Extrusion direction.
Present only if the entity's extrusion direction is not parallel to the WCS Z
axis (optional; default = 0, 0, 1)
220, 230 DXF
only: Y and Z values of extrusion direction
VERTEX Group Codes
VERTEX group codes
Group codes Description
100 Subclass
marker (AcDbVertex)
100 Subclass
marker (AcDb2dVertex or AcDb3dPolylineVertex)
10 DXF:
X value of location point (in OCS when 2D, and WCS when 3D). Application: Location point (in OCS when 2D,
and WCS when 3D).
20, 30 DXF
only: Y and Z values of location point (in OCS when 2D, and WCS
when 3D).
40 Starting
width (optional; default is 0).
41 Ending
width (optional; default is 0).
42 Bulge
(optional; default is 0). The bulge is the tangent of one fourth the included
angle for an arc segment, made negative if the arc goes clockwise from the
start point to the endpoint. A bulge of 0 indicates a straight segment, and a
bulge of 1 is a semicircle.
70 Vertex
flags:.
1 = Extra vertex created by curve-fitting.
2 = Curve-fit tangent defined for this vertex. A curve-fit tangent direction of
0 may be omitted from DXF output but is significant if this bit is set.
4 = Not used,
8 = Spline vertex created by spline-fitting,
16 = Spline frame control point,
32 = 3D polyline vertex,
64 = 3D polygon mesh,
128 = Polyface mesh vertex
50 Curve
fit tangent direction.
71 Polyface
mesh vertex index. Optional. Present only if nonzero.
72 Polyface
mesh vertex index. Optional. Present only if nonzero.
73 Polyface
mesh vertex index. Optional. Present only if nonzero.
74 Polyface
mesh vertex index. Optional. Present only if nonzero.
Every vertex that is part of a polyface mesh has its vertex flag 128 bit set. If the entity supplies the coordinate of a vertex of the mesh, its 64 bit is set as well, and the 10, 20, 30 groups give the vertex coordinate. The vertex index values are determined by the order in which the vertex entities appear within the polyline, with the first being numbered 1.
If the vertex defines a face of the mesh, its vertex flags group has the 128 bit set but not the 64 bit. In this case, the 10, 20, 30 (location) groups of the face entity are irrelevant and are always written as 0 in a DXF file. The vertex indexes that define the mesh are given by 71, 72, 73, and 74 group codes, the values of which specify one of the previously defined vertexes by index. If the index is negative, the edge that begins with that vertex is invisible. The first 0 vertex marks the end of the vertices of the face.
VIEWPORT Group Codes
VIEWPORT group codes
Group codes Description
100 Subclass
marker (AcDbViewport)
10 DXF:
X value of center point. (in WCS)
Application: Center point. (in WCS)
20, 30 DXF
only: Y and Z values of center point. (in WCS)
40 Width
in paper space units.
41 Height
in paper space units.
68 Viewport
status field:
1 = On, but is fully off screen, or is one of the viewports that is not active
because the $MAXACTVP count is currently being exceeded.
0 = Off <positive value > = On, and active. The value indicates the order
of stacking for the viewports, where 1 is the active viewport, 2 is the next,
and so forth.
69 Viewport
ID. Changes each time a drawing is opened. Never saved, except for the paper
space viewport, which is always 1.
The following table lists the xdata that can be attached to viewport entities. In contrast to normal entity data, the order of the extended group codes is important. Also group codes can appear multiple times.
VIEWPORT
xdata group codes
Group codes Description
1001 Application
ID ("ACAD"). This begins a section of xdata that describes the
viewport.
1000 Begin
viewport data. This field will always be the string MVIEW. Other data groups
may appear in the future.
1002 Begin
window descriptor data. This field always is the string.
1070 Extended
data version number. Always the integer 16.
1010 DXF:
X value of view target point.(in WCS)
Application: View target point.(in WCS)
1020,1030 DXF
only: Y and Z values of view target point.(in WCS)
1010 DXF:
X value of view direction vector. (in WCS) Application: View direction vector. (in WCS)
1020,1030 DXF
only: Y and Z values of view direction vector. (in WCS)
1040 View
twist angle.
1040 View
height.
1040 View
center point X value. (in DCS)
1040 View
center point Y value. (in DCS)
1040 Perspective
lens length.
1040 Front
clip plane Z value.
1040 Back
clip plane Z value.
1070 View
mode.
1070 Circle
zoom.
1070 Fast
zoom setting.
1070 UCSICON
setting.
1070 Snap
ON/OFF.
1070 Grid
ON/OFF.
1070 Snap
style.
1070 Snap
ISOPAIR.
1040 Snap
angle.
1040 Snap
base point UCS X coordinate.
1040 Snap
base point UCS Y coordinate.
1040 Snap
X spacing.
1040 Snap
Y spacing.
1040 Grid
X spacing.
1040 Grid
Y spacing.
1070 Hidden
in plot flag.
1002 Begin
frozen layer list (possibly empty). This field always is the string {.
1003 The
names of layers frozen in this viewport. This list may include xref-dependent
layers. Any number of 1003 groups may appear here.
1002 End
frozen layer list. This field always is the string "}".
1002 End viewport data. This field always is the
string "}".
XLINE Group Codes
XLINE group codes
Group codes Description
100 Subclass
marker (AcDbXline)
10 DXF:
X value of first point (in WCS)
Application: First point (in WCS)
20, 30 DXF
only: Y and Z values of first point (in WCS)
11 DXF:
X value of unit direction vector (in WCS) Application: Unit direction vector (in WCS)
21, 31 DXF
only: Y and Z values of unit direction vector (in WCS)
OBJECTS Section
Objects are similar to entities, except that they have no graphical or geometric meaning. All objects that are not entities or symbol table records or symbol tables are stored in this section. This section represents a homogeneous heap of objects with topological ordering of objects by ownership, such that the owners always appear before the objects they own.
The root owner of all objects appearing in this section is the named object dictionary, which is therefore always the first object that appears in this section. Objects in this section may be defined by either AutoCAD or by applications with access to ARX application libraries. The DXF names of application-defined object types should always be associated with a class name in the CLASS section of the DXF file, or else the object record cannot be bound to the application that will interpret it.
Named Object Dictionary
Common Object Group Codes
DICTIONARY Group Codes
GROUP Dictionary Group Codes
MLINESTYLE Dictionary Group Codes
Named Object
Dictionary
The named-object dictionary is the root owner of all nongraphical objects in the drawing with the exception of objects and classes associated with the pre-Release 13 DXF structure. As with other dictionaries, the named-object dictionary record consists solely of associated pairs of entry names and hard ownership pointer references to the associated object.
AutoCAD adds objects to the dictionary with a name (key) that is always prefixed with ACAD_. Other Autodesk applications reserve the right to any prefix that begins with AC. Other software vendors are required to use their registered developer prefix for their entries, in order to avoid name collision. Objects of any type may be given a prefix.
Common Object Group
Codes
The following table shows group codes that apply to virtually all non-graphical entities (objects). When you refer to the table of group codes by entity type, which lists the codes associated with specific entities, keep in mind that the codes shown here can also be present. Some of the group codes are included with an entity only if the entity has non-default values for these properties. When a group is omitted, its default value upon input (when using DXFIN) is indicated in the third column. If the value of a group code is equal to the default, it is omitted upon output (when using DXFOUT).
Common object
group codes
Group codes Description
5 Handle
102 Start
of persistent reactors group, always "{ACAD_REACTORS" (persistent
reactors group appears in all dictionaries except the main dictionary)
330 Soft
pointer ID/handle to owner dictionary
102 End
of persistent reactors group, always "}"
DICTIONARY Group Codes
DICTIONARY group codes
Group codes Description
100 Subclass
marker (AcDbDictionary)
3 Entry
name (one for each entry)
350 Handle
of entry object (one for each entry)
GROUP Dictionary
Group Codes
GROUP dictionary group codes
Group codes Description
100 Subclass
marker (AcDbGroup)
300 Group
description
70 "Unnamed"
flag: 1 = unnamed, 0 = named
71 Selectability
flag: 1 = selectable, 0 = not selectable
340 Handle
of entity in group (one entry per object)
MLINESTYLE Dictionary
Group Codes
MLINESTYLE dictionary group codes
Group codes Description
100 Subclass
marker (AcDbMlineStyle)
2 Mline
style name
70 Flags
(bit coded):.
1 = fill on,
2 = display miters,
16 = Start square end (line) cap,
32 = Start inner arcs cap,
64 = Start round (outer arcs) cap,
256 = End square (line) cap,
512 = End inner arcs,
1024 = End round (outer arcs) cap
3 Style
description (string, 255 characters max).
62 Fill
color (integer, default = 256). Multiple entries can exist; one entry for each
element.
51 Start
angle (real, default is 90 degrees).
52 End
angle (real, default is 90 degrees).
71 Number
of elements
49 Element
offset (real, no default). Multiple entries can exist; one entry for each
element.
62 Element
color (integer, default = 0). Multiple entries can exist; one entry for each
element.
6 Element
linetype (string, default = BYLAYER). Multiple entries can exist; one entry for
each element.
Advanced DXF Issues
This section discusses the advanced concepts related to DXF.
Database Objects
Persistent Inter-Object Reference Handles
Subclass Markers
Extension Dictionary and Persistent Reactors
Extended Data
Object Coordinate Systems (OCS)
Database Objects
AutoCAD drawings consist largely of structured containers for database objects. Database objects each have the following:
n A
handle whose value is unique to the .dwg/.dxf file, and is constant for the
lifetime of the drawing. This format has existed since AutoCAD Release 10, but
as of AutoCAD Release 13, handles are always enabled.
n An
optional xdata table, as entities have had since AutoCAD Release 11.
n An
optional persistent reactor table.
n An
optional ownership pointer to an extension dictionary, which in turn will own
subobjects placed in it by an application.
Symbol tables and symbol table records are
database objects and, thus, have a handle. They can also have xdata and
persistent reactors in their DXF records.
Persistent Inter-Object Reference Handles
A set of group code ranges permit objects to directly specify references to other objects within the same drawing/DXF file. There are four ranges to go with the four types of relationships that can be specified:
n Soft
pointer handle
n Hard
pointer handle
n Soft
owner handle
n Hard
owner handle
These handle types are manifested as entity
names in AutoLISP, as ads_name values in ADS and as like-named classes derived
from ARX. These values are always maintained in insert, xref, and wblock
operations, such that references between objects in a set being copied are
updated to point to the copied objects, while references to other objects
remain unchanged.
Also, a group code range for
"arbitrary" handles is defined to allow convenient storage of handle
values that are not converted to entity names and then translated in insert,
xref, or wblock.
Note If you use 1005 xdata group codes to store
handles, they are treated as soft pointer handles, which means that when groups
of objects are copied or are inserted into another drawing, references between
the involved objects are translated. Although 1005 xdata items are always
returned as handles in AutoLISP and ADS, all of the reference handle group code
ranges are represented as "entity names" in AutoLISP and as ads_name
structures in ADS.
Pointer and Ownership References
Hard and Soft
Arbitrary Handles
1005 Group Codes
Pointer and Ownership
References
A pointer is a reference that indicates usage but not possession or responsibility for another object. Pointer references mean that the object uses the other object in some way, and shares access to it.
An ownership reference means that an owner object is responsible for the objects for which it has an owner handle. Ownership references direct the writing of the entire dwg and dxf files in a generic manner, such as beginning from a few key root objects, the writing of an owner handle.
An object can have any number of pointer references associated with it but can have only one owner.
Hard and Soft
Hard references, whether they are pointer or owner, protect an object from being purged. Soft references do not.
In AutoCAD, block definitions and complex entities are hard owners of their elements. A symbol table and dictionaries are soft owners of their elements. Polyline entities are hard owners of their vertex and seqend entities. Insert entities are hard owners of their attrib and seqend entities.
When establishing a reference to another object, it is recommended that you think about whether the reference should protect an object from the PURGE command.
Arbitrary Handles
Arbitrary handles are distinct in that they are not translated to session persistent identifiers internally, to entity names in AutoLISP, and so on. They are stored as handles. When translation of handle values are translated in drawing-merge operations, arbitrary handles are ignored.
In all environments, arbitrary handles can be exchanged for entity names of the current drawing by means of the handent functions. A common usage of arbitrary handles is to refer to objects in external dxf and dwg files.
1005 Group Codes
1005 xdata group codes have the same behavior and semantics as soft pointers, which means that they are translated whenever the host object is merged into a different drawing. However, 1005 items are not translated to session-persistent identifiers, internally entity names in AutoLISP and ADS. They are stored as handles.
Subclass Markers
A big problem with filing a stream of group data is that a single object may be composed of several filer members, one for each level of inheritance where filing is done, which can be done by different developers. Because each level of inheritance can evolve separately, it is necessary to segregate the data of each class filer member from each other.
All class filer members are expected to preceded their class-specific portion of instance data with a "subclass" marker--a 100 group code followed by a string with the actual name of the class. This does not affect the state needed to define the object's state, but it provides a means for the DXF file parsers to direct the group codes to the corresponding application software.
For example, an object which has data from different derived classes would be represented as follows:
999
FOOGRANDCHILD,
defined by class AcDbSonOfSonOfFoo, which
999
is derived from AcDbSonOfFoo
0
FOOGRANDCHILD
5
C2
100
AcDbFoo
999
Uses
10/20/30 group codes
10
1.1
20
2.3
30
7.3
100
AcDbSonOfFoo
999
Also
uses 10/20/30 group codes, for a different purpose
10
1.1
20
2.3
30
7.3
100
AcDbSonOfSonOfFoo
999
Also
uses 10/20/30 group codes, for yet another purpose
10
13.2
20
23.1
30
31.2
999
Now
for the Xdata
1001
APP_1
1070
45
1001
APP_2
1004
18A5B3EF2C199A
Extension Dictionary and Persistent Reactors
The extension dictionary is an optional sequence that stores the handle of a dictionary object that belongs to the current object, which in turn may contain entries. This facility allows attachment of arbitrary database objects to any database object. Any object or entity may have this section.
Persistent reactors are an optional sequence that stores object handles of objects registering themselves as reactors on the current object. Any object or entity may have this section.
Extended Data
Extended data is created by AutoLISP or ADS applications. If an entity contains extended data, it follows the entity's normal definition data. The group codes 1000 through 1071 describe extended data. The following is an example of an entity containing extended data in DXF format.
Normal entity definition data:
0
INSERT
8
x
5
5
F11
15
2
BLOCK_A
10
0.0
20
0.0
30
0.0
Extended definition data:
1001
AME_SOL
1002
{
1070
0
1071
1.95059E+06
1070
519
1010
2.54717
1020
2.122642
1030
2.049201
1005
ECD
1005
EE9
1005
0
1040
0.0
1040
1.0
1000
MILD_STEEL
The group code 1001 indicates the beginning
of extended data. In contrast to normal entity data, with extended data the
same group code can appear multiple times, and order is important.
Extended data are grouped by registered
application name. Each registered application's group begins with a 1001 group
code with the application name as the string value. Registered application
names correspond to APPID symbol table entries.
An application can use as many APPID names
as needed. APPID names are permanent, although they can be purged if they
aren't currently used in the drawing. Each APPID name can have no more than one
data group attached to each entity. Within an application's group, the sequence
of extended data groups and their meaning is defined by the application.
The extended data group codes listed in the
following table values as described:
Extended data group codes and descriptions
Entity name Group
code Description
String 1000 Strings in extended data
can be up to 255 bytes long (with the 256th byte reserved for the null
character).
Application name 1001
Application names
can be up to 31 bytes long (the 32nd byte is reserved for the null character).
Note Do not add a 1001 group into your extended data, because AutoCAD
assumes it is the beginning of a new application extended data group.
Control string 1002 An extended data control
string can be either "{"or "}". These braces enable
applications to organize their data by subdividing the data into lists. The
left brace begins a list, and the right brace terminates the most recent list.
Lists can be nested.
When AutoCAD reads the extended data for a particular application, it checks to
ensure that braces are balanced.
Layer name 1003 Name of the layer associated with the extended
data.
Binary data 1004 Binary data is organized into variable-length
chunks. The maximum length of each chunk is 127 bytes. In ASCII DXF files,
binary data is represented as a string of hexadecimal digits, two per binary
byte.
Database handle 1005 Handles
of entities in the drawing database.
Note When a drawing with handles
and extended data handles is imported into another drawing using INSERT, INSERT
*, XREF Bind, XBIND, or partial DXFIN, the extended data handles are translated
in the same manner as their corresponding entity handles, thus maintaining
their binding. This is also done in the EXPLODE block operation or for any
other AutoCAD operation. When AUDIT detects an extended data handle that
doesn't match the handle of an entity in the drawing file, it is considered an
error. If AUDIT is fixing entities, it sets the handle to 0.
3 reals 1010,1020,1030
Three real values, in the order X, Y, Z.
They can be used as a point or vector record. AutoCAD never alters their value.
World space position 1011,1021,1031 Unlike a simple 3D point, the world space
coordinates are moved, scaled, rotated, and mirrored along with the parent
entity to which the extended data belongs. The world space position is also
stretched when the STRETCH command is applied to the parent entity and this
point lies within the select window.
World space displcm't 1012,
1022, 1032 Also a 3D point that is
scaled, rotated, and mirrored along with the parent (but is not moved or
stretched).
World direction 1013,1023,1033 Also a 3D point that is rotated and mirrored
along with the parent (but is not moved, scaled, or stretched).
Real 1040 A real value.
Distance 1041 A real value that is
scaled along with the parent entity.
Scale factor 1042 Also a real value that is
scaled along with the parent. The difference between a distance and a scale
factor is application-defined.
Integer 1070 A 16-bit integer (signed
or unsigned).
Long 1071 A 32-bit signed (long)
integer.
For more information on extended data and the APPID table, refer to the AutoCAD Customization Guide.
Object Coordinate
Systems (OCS)
To save space in the drawing database (and in the DXF file), the points associated with each entity are expressed in terms of the entity's own Object Coordinate System (OCS). With OCS, the only additional information needed to describe the entity's position in 3D space is the 3D vector describing the Z axis of the OCS, and the elevation value.
For a given Z axis (or extrusion) direction, there are an infinite number of coordinate systems, defined by translating the origin in 3D space and by rotating the X and Y axes around the Z axis. However, for the same Z axis direction, there is only one OCS. It has the following properties:
n Its
origin coincides with the WCS origin.
n The
orientation of the X and Y axes within the XY plane are calculated in an
arbitrary, but consistent manner. AutoCAD performs this calculation using the Arbitrary
Axis Algorithm.
For some entities, the OCS is equivalent to
the WCS and all points (DXF groups 10 -37) are expressed in World coordinates.
See the following table.
Coordinate systems associated with an entity type
Entities |
Notes |
3D entities such as line, point, 3dface, 3D
polyline, 3D vertex, 3D mesh, 3D mesh vertex |
These entities do not lie in a particular plane. All
points are expressed in world coordinates. Of these entities, only lines and
points can be extruded. Their extrusion direction can differ from the World Z
axis. |
2D entities such as circle, arc, solid, trace, text,
attrib, attdef, shape, insert, 2D polyline, 2D vertex |
These entities are planar in nature. All points are
expressed in object coordinates. All of these entities can be extruded. Their
extrusion direction can differ from the World Z axis. |
Dimension |
Some of a dimension's points are expressed in WCS and
some in OCS. |
Viewport |
Expressed in World coordinates. |
Once AutoCAD has established the OCS for a given entity, here's how it works:
The elevation value stored with an entity indicates how far to shift the XY plane along the Z axis (from the WCS origin) to make it coincide with the plane that contains the entity. How much of this is the user-defined elevation is unimportant.
Any 2D points entered through the UCS are transformed into the corresponding 2D points in the OCS, which is shifted and rotated with respect to the UCS.
These are a few ramifications of this process:
n You
cannot reliably find out what UCS was in effect when an entity was acquired.
n When
you enter the XY coordinates of an entity in a given UCS and then do a DXFOUT,
you probably won't recognize those XY coordinates in the DXF file. You must
know the method by which AutoCAD calculates the X and Y axes in order to work
with these values.
n The
elevation value stored with an entity and output in DXF files is a sum of the
Z-coordinate difference between the UCS XY plane and the OCS XY plane, and the
elevation value that the user specified at the time the entity was drawn.
Arbitrary Axis Algorithm
The arbitrary axis algorithm is used by AutoCAD internally to implement the arbitrary but consistent generation of object coordinate systems for all entities which use object coordinates.
Given a unit-length vector to be used as the Z axis of a coordinate system, the arbitrary axis algorithm generates a corresponding X axis for the coordinate system. The Y axis follows by application of the right-hand rule.
The method is to examine the given Z axis (also called the normal vector) and see if it is close to the positive or negative World Z axis. If it is, cross the World Y axis with the given Z axis to arrive at the arbitrary X axis. If not, cross the World Z axis with the given Z axis to arrive at the arbitrary X axis. The boundary at which the decision is made was chosen to be both inexpensive to calculate and completely portable across machines. This is achieved by having a sort of "square" polar cap, the bounds of which is 1/64, which is precisely specifiable in six decimal-fraction digits and in six binary-fraction bits.
The algorithm does the following. (All vectors are assumed to be in 3D space and specified in the World Coordinate System).
Let
the given normal vector be called N.
Let
the world Y axis be called Wy, which is always (0,1,0).
Let
the world Z axis be called Wz, which is always (0,0,1).
Here we are looking for the arbitrary X and
Y axes to go with the normal N. They will be called Ax and Ay. N could also be
called Az (the arbitrary Z axis) as follows:
If
(abs (Nx) < 1/64) and (abs (Ny) < 1/64) then
Ax = Wy X N (where "X" is the cross-product operator).
Otherwise,
Ax = Wz X N.
Scale
Ax to unit length.
The method of getting the Ay vector is
Ay = N
X Ax. Scale Ay to unit length.
Writing DXF Interface Programs
Writing a program that communicates with AutoCAD by means of the DXF mechanism appears more difficult than it actually is. The DXF format makes it easy to ignore information you don't need, while reading the information you do need.
The following example is a Microsoft BASIC™ program that reads a DXF file and extracts all the line entities from the drawing (ignoring lines that appear inside blocks). It displays the endpoints of these lines on the screen. This program is an example of how simple a DXF-reading program can be.
1000 REM
1010 REM Extract lines from DXF file
1020 REM
1030 G1% = 0
1040 LINE INPUT "DXF file name: "; A$
1050 OPEN "i", 1, A$ + ".dxf"
1060 REM
1070 REM Ignore until section start encountered
1080 REM
1090 GOSUB 2000
1100 IF G% <> 0 THEN 1090
1110 IF S$ <> "SECTION" THEN 1090
1120 GOSUB 2000
1130 REM
1140 REM Skip unless ENTITIES section
1150 REM
1160 IF S$ <> "ENTITIES" THEN 1090
1170 REM
1180 REM Scan until end of section, processing
LINEs
1190 REM
1200 GOSUB 2000
1210 IF G% = 0 AND S$ = "ENDSEC" THEN
2200
1220 IF G% = 0 AND S$ = "LINE" THEN
GOSUB 1400 : GOTO 1210
1230 GOTO 1200
1400 REM
1410 REM Accumulate LINE entity groups
1420 REM
1430 GOSUB 2000
1440 IF G% = 10 THEN X1 = X : Y1 = Y : Z1 = Z
1450 IF G% = 11 THEN X2 = X : Y2 = Y : Z2 = Z
1460 IF G% = 0 THEN PRINT "Line from
(";X1;",";Y1;",";Z1;") to
(";X2;",";Y2;",";Z2;")":RETURN
1470 GOTO 1430
2000 REM
2010 REM Read group code and following value
2020 REM For X coordinates, read Y and possibly Z
also
2030 REM
2040 IF G1% < 0 THEN G% = -G1% : G1% = 0 ELSE
INPUT #1, G%
2050 IF G% < 10 OR G% = 999 THEN LINE INPUT #1,
S$ : RETURN
2060 IF G% >= 38 AND G% <= 49 THEN INPUT #1,
V : RETURN
2080 IF G% >= 50 AND G% <= 59 THEN INPUT #1,
A : RETURN
2090 IF G% >= 60 AND G% <= 69 THEN INPUT #1,
P% : RETURN
2100 IF G% >= 70 AND G% <= 79 THEN INPUT #1,
F% : RETURN
2110 IF G% >= 210 AND G% <= 219 THEN 2130
2115 IF G% >= 1000 THEN LINE INPUT #1, T$ :
RETURN
2120 IF G% >= 20 THEN PRINT "Invalid group
code";G% : STOP
2130 INPUT #1, X
2140 INPUT #1, G1%
2150 IF G1% <> (G%+10) THEN PRINT
"Invalid Y coord code";
G1% : STOP
2160 INPUT #1, Y
2170 INPUT #1, G1%
2180 IF G1% <> (G%+20) THEN G1% = -G1% ELSE
INPUT #1, Z
2190 RETURN
2200 CLOSE 1
Writing a program that constructs a DXF file
poses different problems. You must maintain consistency within the drawing,
although with AutoCAD you can omit many items in a DXF file and still obtain a
usable drawing. The entire HEADER section can be omitted if you don't set
header variables. Any of the tables in the TABLES section can be omitted if you
don't need to make entries, and the entire TABLES section can be dropped if
nothing in it is required. If you define any linetypes in the LTYPE table, this
table must appear before the LAYER table. If no block definitions are used in
the drawing, the BLOCKS section can be omitted. If present, the BLOCKS section
must appear before the ENTITIES section. Within the ENTITIES section, you can
reference layer names even though you haven't defined them in the LAYER table.
Such layers are automatically created with color 7 and the CONTINUOUS linetype.
The EOF item must be present at the end of file.
The following Microsoft BASIC program
constructs a DXF file representing a polygon with a specified number of sides,
leftmost origin point, and side length. This program supplies only the ENTITIES
section of the DXF file and places all entities generated on the default layer
0. Because this program doesn't create the drawing header, the drawing limits,
extents, and current view will be invalid after performing a DXFIN on the
drawing generated by this program. You can do a ZOOM Extents to fill the screen
with the drawing generated. Then adjust the limits manually.
1000 REM
1010 REM Polygon generator
1020 REM
1030 LINE INPUT "Drawing (DXF) file name:
"; A$
1040 OPEN "o", 1, A$ + ".dxf"
1050 PRINT #1, 0
1060 PRINT #1, "SECTION"
1070 PRINT #1, 2
1080 PRINT #1, "ENTITIES"
1090 PI = ATN(1) * 4
1100 INPUT "Number of sides for polygon:
"; S%
1110 INPUT "Starting point (X,Y): "; X,
Y
1120 INPUT "Polygon side: "; D
1130 A1 = (2 * PI) / S%
1140 A = PI / 2
1150 FOR I% = 1 TO S%
1160 PRINT #1, 0
1170 PRINT #1, "LINE"
1180 PRINT #1, 8
1190 PRINT #1, "0"
1200 PRINT #1, 10
1210 PRINT #1, X
1220 PRINT #1, 20
1230 PRINT #1, Y
1240 PRINT #1, 30
1250 PRINT #1, 0.0
1260 NX = D * COS(A) + X
1270 NY = D * SIN(A) + Y
1280 PRINT #1, 11
1290 PRINT #1, NX
1300 PRINT #1, 21
1310 PRINT #1, NY
1320 PRINT #1, 31
1330 PRINT #1, 0.0
1340 X = NX
1350 Y = NY
1360 A = A + A1
1370 NEXT I%
1380 PRINT #1, 0
1390 PRINT #1, "ENDSEC"
1400 PRINT #1, 0
1410 PRINT #1, "EOF"
1420 CLOSE 1
As long as a properly formatted item appears
on the line on which the data is expected, DXFIN accepts it. (Of course, string
items should not have leading spaces unless these are intended to be part of
the string.) This program takes advantage of this flexibility in input format
and does not generate a file exactly like one generated by AutoCAD.
In the case of an error in using DXFIN to
load, AutoCAD reports the error with a message indicating the nature of the
error and the last line processed in the dxf file before the error was
detected. This may not be the line on which the error occurred, especially in
the case of errors such as the omission of required groups.
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:
n A
2-byte integer with the least significant byte first and the most significant
byte last
n An
8-byte IEEE double-precision floating-point number stored with the least
significant byte first and the most significant byte last
n An
ASCII string terminated by a 0 (NULL) byte
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
1071 True 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.
DXB Files
The DXF file formats are complete representations of an AutoCAD drawing that can be written and read by AutoCAD and other programs. However, programs executed by means of the external commands facility often need to supply simple geometric input to AutoCAD. For these purposes, AutoCAD supports another file format, called DXB (drawing interchange binary), which is limited in the entities it can represent.
To load a DXB file, enter the DXBIN command:
dxbin
When AutoCAD prompts you, respond with the name of the file you want to load. You do not need to include a .dxb file because the type is assumed.
There is no direct AutoCAD command for writing a DXB file, but the ADI "AutoCAD file output formats" plotter driver can write such a file. If you want to create a DXB file from an AutoCAD drawing, configure the "file output formats" plotter and select its "AutoCAD DXB file" output option.
The DXB File Format
The DXB File Format
This information is for experienced programmers and is subject to change without notice.
The format of a DXB file is as follows:
Header:
"AutoCAD DXB 1.0" CR LF ^Z NUL (19 bytes)
Data: ...Zero or more data records...
Terminator:
NUL (1 byte)
Each data record begins with a single byte
identifying the record type, followed by data items. The data items have
various forms of representation and encoding. In the following descriptions of
the letter codes, each data item is prefixed with a letter and a hyphen.
w- 16-bit integer, byte
reversed in the standard 80x86 style the least significant byte first, and the
most significant byte second).
f- IEEE 64-bit floating-point
value stored with LSB first, MSB last (as stored by an 80x87).
l- 32-bit integer with the
bytes reversed 80x86 style.
n- Either a 16-bit integer or
a floating-point number, depending on the most recent setting of the number
mode data item. The number mode defaults to 0, signifying integers. If set to
1, all n- items will be read as floating point.
u- Either a 32-bit integer or
a floating-point number, depending on the most recent number mode setting. If a
32-bit integer, the value is scaled by multiplying it by 65,536 (216). If a
floating-point value, no scaling is applied.
a- An angle. If number mode is
integer, this is a 32-bit integer representing an angle in units of millionths
of a degree (range 0 to 360,000,000). If a floating-point number, it represents
degrees.
In the following table, the lengths include
the item-type byte and assume that the number mode is set to 0 (integer mode).
If number mode is floating point, add 6 bytes to the length for each n- item
present and 4 bytes for each a- or u- item present.
Byte length for item types
Item type |
Code |
Data items |
Length (bytes) |
Line |
1 |
n-fromx
n-fromyn-tox n-toyn-fromx n-fromy n-fromzn-tox n-toy n-toz |
13 |
Point |
2 |
n-x
n-y |
5 |
Circle |
3 |
n-ctrx
n-ctry n-rad |
7 |
Arc |
8 |
n-ctrx
n-ctry n-rada-starta a-enda |
19 |
Trace |
9 |
n-x1
n-y1 n-x2 n-y2n-x3 n-y3 n-x4 n-y4 |
17 |
Solid |
11 |
n-x1
n-y1 n-x2 n-y2n-x3 n-y3 n-x4 n-y4 |
17 |
Seqend |
17 |
(none) |
1 |
Polyline |
19 |
w-closureflag |
3 |
Vertex |
20 |
n-x
n-y |
5 |
3Dface |
22 |
n-x1
n-y1 n-z1n-x2 n-y2 n-z2n-x3 n-y3 n-z3n-x4 n-y4 n-z4 |
25 |
Scale
factor |
128 |
f-scalefac |
9 |
New
layer |
129 |
"layername"
NUL |
layername
length + 2 |
Line
extension |
130 |
n-tox
n-toy |
5 |
Trace
extension |
131 |
n-x3
n-y3 n-x4 n-y4 |
9 |
Block
base |
132 |
n-bx
n-by |
5 |
Bulge |
133 |
u-2h/d |
5 |
Width |
134 |
n-startw
n-endw |
5 |
Number
mode |
135 |
w-mode |
3 |
New
color |
136 |
w-colornum |
3 |
3Dline
extension |
137 |
n-tox
n-toy n-toz |
7 |
The line extension item extends the last line or line extension from its To point to a new To point. The trace extension item extends the last trace solid, or trace extension from its x3,y3-x4,y4 ending line to a new x3,y3--x4,y4 line.
The scale factor is a floating-point value by which all integer coordinates are multiplied to obtain the floating-point coordinates used by the entities. The initial scale factor when a file is read is 1.0. The new layer item creates a layer if none exists, giving the new layer the same defaults as the LAYER New command, and sets that layer as the current layer for subsequent entities. At the end of the DXB file load, the layer in effect before the command is restored.
The block base item specifies the base (origin) point of a created block. The block base must be defined before the first entity record is encountered. If DXB does not define a block, this specification is ignored.
A polyline consists of straight segments of fixed width connecting the vertices, except as overridden by the bulge and width items. The closure flag should be 0 or 1; if it is 1, there is an implicit segment from the last vertex (immediately before the Seqend) to the first vertex.
A bulge item, encountered between two vertex items (or after the last vertex of a closed polyline), indicates that the two vertices are connected by an arc rather by than a straight segment. If the distance between the vertices has length d, and the perpendicular distance from the midpoint of that segment to the arc is h, then the magnitude of the bulge is (2 * h / d). The sign is negative if the arc from the first vertex to the second is clockwise. A semicircle thus has a bulge of 1 (or -1). If the number mode is 0 (integer), bulge items are scaled by 2 16. If the number mode has been set to floating point, then the floating-point value supplied is 2*h/d (not scaled).
The width item indicates the starting and ending widths of the segment (straight or curved) connecting two vertices. This width stays in effect until the next width item or the seqend. If there is a width item between the polyline item and the first vertex, it is stored as a default width for the polyline. This saves considerable database space if the polyline has several segments of this width.
The number mode item controls the mode of items with types given in the preceding table as n-, a-, or u-. If the value supplied is 0, these values will be integers; otherwise, they are floating point.
To remember the last to-point, lines share the same cells, so do not mix extension groups for the two entities without an initial group before the extension. There is no extension group for 3D faces, because there is no obvious edge to extend from.
The new color group specifies the color for subsequent entities in the DXB file. The w-colornum word argument is in the range from 0 to 256. 0 means color by block, 1-255 are the standard AutoCAD colors, and 256 means color by layer. A color outside the range from 0 to 256 sets the color back to the current entity color (you can do this deliberately, and it can be quite useful). The initial entity color of material added by DXBIN is the current entity color.
All points specified in the DXB file are interpreted in terms of the current UCS at the time that the DXBIN command is executed.
Outline Help
The
Outline button displays an additional window which provides the contents of the
Help file in an outline form. This outline makes it easier to view various
parts of the document and navigate directly to the section you are interested
in.
The
Find button displays the Find dialog which provides full text search over the
entire document. The Find dialog functions in a similar manner as the Search
dialog.
The
hdkctnts.dll file must be installed in the windows directory for
the Outline and Find buttons to be functional. Additionally, the hdkctnts.hlp
file provides help specific to the Outline window. It should also be installed
in the windows directory.
If
the hdkctnts.dll file is not properly installed in the windows
directory, choosing the Outline or Find buttons result in the Windows error
message of "Routine not found".