⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dxf.txt

📁 AutoCAD DXF version 10 File Format [Autodesk Inc.] AutoCAD软件中的DXF格式的说明
💻 TXT
📖 第 1 页 / 共 5 页
字号:
[ This file is an excerpt from the AutoCAD Release 10 Reference Manual.
  Copyright (C) 1988 Autodesk, Inc.  All rights reserved. ]

                               Appendix C
                   Drawing Interchange and File Formats


AutoCAD can be used by itself as a complete drawing editor.  In some appli-
cations, however, other programs must examine drawings created by AutoCAD
or generate drawings to be viewed, modified, or plotted with AutoCAD.

For example, if you've made an architectural drawing with AutoCAD, using
INSERTed parts to represent windows, doors, and so on, you can process the
drawing file and produce a bill of materials of all the items used in the
drawing, or even make energy use calculations based on the area and the
number and type of windows used.  Another possible application is to use
AutoCAD to describe structures that are then sent to a large computer for
finite element structural analysis.  You can compute stresses and displace-
ments and send back information to display the deformed structure as an
AutoCAD drawing.

Since the AutoCAD drawing database (.dwg file) is written in a very compact
format that changes significantly from time to time as new features are
added, we do not document its format and do not recommend that you attempt
to write programs to read it directly.  To assist in interchanging drawings
between AutoCAD and other programs, a "Drawing Interchange" file format
(DXF(tm)) has been defined.  All implementations of AutoCAD accept this
format and are able to convert it to and from their internal drawing file
representation.

AutoCAD also supports the Initial Graphics Exchange Standard (IGES) file
format.  The information comprising an AutoCAD drawing can be written out
in IGES format, and IGES files can be read and converted to AutoCAD's
internal format.


C.1  ASCII Drawing Interchange (DXF) Files

This section describes AutoCAD's DXF (drawing interchange) file format and
the commands provided to read and write these files.  DXF files are stan-
dard ASCII text files.  They can easily be translated to the formats of
other CAD systems, or submitted to other programs for specialized analysis.


C.1.1  DXFOUT Command - Writing a DXF File

You can generate a drawing interchange file from an existing drawing by
means of the Drawing Editor's DXFOUT command.  The command format is:

    Command:  DXFOUT   File name <default>:  (name or RETURN)

The default name for the output file is the same as that of the current
drawing, but with a file type of ".dxf".  If you specify an explicit file
name, do not include a file type; ".dxf" is assumed.  If a file with the
same name already exists, it is deleted.  Next, DXFOUT asks what precision

                                                                          1
AutoCAD Reference Manual

you want for floating-point numbers and permits output of a partial DXF
file containing only selected objects.

    Enter decimal places of accuracy (0 to 16)/Entities/Binary <6>:

The "Binary" option is described later in this appendix. If you respond
with "Entities" (or just "E"), DXFOUT will ask you to select the objects
you want written to the DXF file.  Only the objects you select will be
included in the output file - symbol tables (including Block Definitions)
will not be included.  Once you've selected the desired objects, AutoCAD
will prompt again for the numeric precision:

    Enter decimal places of accuracy (0 to 16)/Binary <6>:


C.1.2  DXFIN Command - Loading a DXF File

A drawing interchange file can be converted into an AutoCAD drawing by
means of the DXFIN command.  First enter the Drawing Editor using the
"Create new drawing" task from the Main Menu.  Then issue the DXFIN com-
mand.

    Command:  DXFIN   File name:  (name)

Enter the name of the drawing interchange file to be loaded.


Full DXFIN

To load a complete DXF file, you must use DXFIN in an empty drawing, before
any entities have been drawn and before any additional Block definitions,
layers, linetypes, text styles, named views, named coordinate systems, or
named viewport configurations have been created.  (If your prototype draw-
ing contains any such items, use Main Menu Task 1's "name=" technique to
create a new drawing without a prototype.)

If any errors are detected during the input, the new drawing is discarded.
Otherwise, an automatic "ZOOM All" is performed to set the drawing extents.


Partial DXFIN

If the current drawing is not empty, DXFIN loads only the ENTITIES section
of the DXF file, adding the entities found there to the current drawing.
In this case, DXFIN displays the message:

    Not a new drawing -- only ENTITIES section will be input.

If errors are detected during such partial DXF input, the drawing is
returned to the state it was in before the DXFIN command.  Otherwise, the
newly added entities are drawn.



2
                                   (C) Drawing Interchange and File Formats

C.1.3  DXF File Format

This section describes the format of a DXF file in detail.  It contains a
great deal of technical information that you need only if you're writing
your own program to process DXF files.  Otherwise, you can skip this sec-
tion.

It would probably be helpful to produce a DXF file from a small drawing,
print it out, and refer to it occasionally while reading the information
presented below.


C.1.3.1  General File Structure

A Drawing Interchange File is simply an ASCII text file with a file type of
".dxf" and specially-formatted text.  The overall organization of a DXF
file is as follows:

  1. HEADER section - General information about the drawing is found in
     this section of the DXF file.  Each parameter has a variable name
     and an associated value.

  2. TABLES section -- This section contains definitions of named
     items.

       o  Linetype (LTYPE) table
       o  Layer table
       o  Text style (STYLE) table
       o  View table
       o  User Coordinate System (UCS) table
       o  Viewport configuration (VPORT) table
       o  Drawing manager (DWGMGR) table (for future use)

  3. BLOCKS section - This section contains Block Definition entities
     describing the entities comprising each Block in the drawing.

  4. ENTITIES section - This section contains the drawing entities,
     including any Block References.

  5. END OF FILE

If you use DXFOUT's "Entities" option, the resulting DXF file will contain
only the ENTITIES and END OF FILE sections, and the ENTITIES section will
reflect only the objects you select for output.

A DXF file is composed of a multiplicity of groups, each of which occupies
two lines in the DXF file.  The first line of a group is a group code,
which is a positive nonzero integer output in FORTRAN "I3" format (that is,
right justified and blank filled in a three character field).  The second
line of the group is the group value, in a format which depends on the type
of the group as specified by the group code.



                                                                          3
AutoCAD Reference Manual

The specific assignment of group codes depends upon the item being
described in the file.  However, the type of the value this group supplies
is derived from the group code in the following way:

                    Group code range   Following value
                          0 - 9       String
                         10 - 59      Floating-point
                         60 - 79      Integer
                        210 - 239     Floating-point
                           999        Comment (string)

Thus a program can easily read the value following a group code without
knowing the particular use of this group in an item in the file.  The
appearance of values in the DXF file is not affected by the setting of the
UNITS command: coordinates are always represented as decimal (or possibly
scientific notation if very large) numbers, and angles are always repre-
sented in decimal degrees with zero degrees to the east of origin.

Variables, table entries, and entities are described by a group that intro-
duces the item, giving its type and/or name, followed by multiple groups
that supply the values associated with the item.  In addition, special
groups are used for file separators such as markers for the beginning and
end of sections, tables, and the file itself.

Entities, table entries, and file separators are always introduced with a 0
group code that is followed by a name describing the item.


C.1.3.2  Group Codes

Group codes are used both to indicate the type of the value of the group,
as explained above, and to indicate the general use of the group.  The spe-
cific function of the group code depends on the actual variable, table
item, or entity description.  This section indicates the general use of
groups, noting as "(fixed)" any that always have the same function.

   Group code                           Value type
       0        Identifies the start of an entity, table entry, or file
                separator.  The text value that follows indicates which.
       1        The primary text value for an entity.
       2        A name; Attribute tag, Block name, etc.
      3-4       Other textual or name values.
       5        Entity handle expressed as a hexadecimal string.
       6        Line type name (fixed).
       7        Text style name (fixed).
       8        Layer name (fixed).
       9        Variable name identifier (used only in HEADER section of
                the DXF file).
       10       Primary X coordinate (start point of a Line or Text
                entity, center of a Circle, etc.).
     11-18      Other X coordinates.
                                                             continued ...


4
                                   (C) Drawing Interchange and File Formats

   Group code                           Value type
       20       Primary Y coordinate.  2n values always correspond to 1n
                values and immediately follow them in the file.
     21-28      Other Y coordinates.
       30       Primary Z coordinate.  3n values always correspond to 1n
                and 2n values and immediately follow them in the file.
     31-37      Other Z coordinates.
       38       This entity's elevation if nonzero (fixed).  Output only
                if system variable FLATLAND is set to 1.
       39       This entity's thickness if nonzero (fixed).
     40-48      Floating-point values (text height, scale factors, etc.).
       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-58      Angles.
       62       Color number (fixed).
       66       "Entities follow" flag (fixed).
     70-78      Integer values, such as repeat counts, flag bits, or
                modes.
 210, 220, 230  X, Y, and Z components of extrusion direction.
      999       Comments


C.1.4  Comments

The 999 group code indicates that the following line is a comment string.
DXFOUT does not currently include such groups in its output file, but DXFIN
honors them and ignores the comments.  Thus, you can use the 999 group to
include comments in a DXF file you've edited.  For example:

    999
    This is a comment.
    999
    This is another comment.


C.1.5  File Sections

The DXF file is subdivided into four sections.  File separator groups are
used to delimit these file sections.  The following is an example of a void
DXF file with only the section markers and table headers present.

      0                           (Begin HEADER section)
    SECTION
      2
    HEADER
        <<<<Header variable items go here>>>>
      0
    ENDSEC                        (End HEADER section)
      0                           (Begin TABLES section)
    SECTION
      2

                                                                          5

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -