|=================================================|
| |
| Drawing Interchange and File Formats |
| Relea 12 |
| Copyright (c) 1982-1990, 1992 Autodesk, Inc. |
| All Rights Rerved |
| |
|=================================================|
AutoCAD can be ud by itlf as a complete drawing editor. In some
applications, 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 inrted parts to reprent windows, doors, and so on, you can
process the drawing file and produce a bill of materials of all
items ud in the drawing, or even make energy-u calculations
bad on the area and the number and type of windows ud. Another
possible application is to u AutoCAD to describe structures and
then nd the descriptions to a more powerful computer for finite-
element structural analysis. You can compute stress and
displacements and nd back information to display the deformed
structure as an AutoCAD drawing.
Since the AutoCAD drawing databa (.dwg file) is written in a
compact format that changes significantly as new features are added
to AutoCAD, 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) has been defined. All implementations
of AutoCAD accept this format and are able to convert it to and from
their internal drawing file reprentation.
AutoCAD also supports the Initial Graphics Exchange Specification
(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 the AutoCAD internal format.
ASCII Drawing Interchange (DXF) Files
*************************************
学习盘发This ction describes the AutoCAD DXF (drawing interchange file)
format and the commands provided to read and write the files. DXF
files are standard ASCII text files. They can easily be translated
to the formats of other CAD systems or submitted to other programs
for specialized analysis. AutoCAD can also produce or read a binary
form of the full DXF file. This feature is described in detail later
in this chapter.
DXFOUT Command - Writing a DXF File
===================================
You can generate a drawing interchange file from an existing drawing
by means of the DXFOUT command:
Command: dxfout
When AutoCAD prompts you, respond with a filename or press 5 to
accept the default.
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 filename, you do not need to include a file type; .dxf is
assumed. If a file with the same name already exists, the existing
file is deleted. If you specify the file using a file dialogue box,
and a file with the same name already exists, AutoCAD tells you;
allowing you to OK or cancel the deletion. Next, DXFOUT asks what
precision you want for floating-point numbers and permits output of
a partial DXF file containing only lected objects.
Enter decimal places of accuracy (0 to 16)/Entities/Binary <6>:
The Binary option is described later in this chapter.
If you respond with "entities" (or just "e"), DXFOUT asks you to
lect the objects you want written to the DXF file. Only the
objects you lect are included in the output file - symbol tables
(including Block Definitions) will not be included. Once you've
lected the desired objects, AutoCAD again prompts you for the
numeric precision:
falhoodEnter decimal places of accuracy (0 to 16)/Binary <6>:
DXFIN Command - Loading a DXF File
==================================
A drawing interchange file can be converted into an AutoCAD drawing
by means of the DXFIN command:
Command: dxfin
When AutoCAD prompts you, respond with the name of the drawing
interchange file to be loaded.
Full DXFIN
-
---------
To load a complete DXF file, you must u DXFIN in an empty drawing,
before any entities have been drawn and before any additional Block
definitions, layers, linetypes, text styles, dimension styles, named
views, named coordinate systems, or named viewport configurations
have been created.
NOTE: If the drawing you are using as a prototype is not empty, you
might find it helpful to open a new drawing using the No
< button of the Create New Drawing dialogue box, as
described in chapter 4 of the "AutoCAD Reference Manual." You should
also be aware that some third-party applications include an acad.lsp
or .mnl file that modifies your drawing upon startup.
If any errors are detected during the input, the new drawing is
discarded. Otherwi, an automatic ZOOM All is performed to t the
drawing extents.
Partial DXFIN
-------------
If the current drawing is not empty, DXFIN loads only the ENTITIES
ction of the DXF file, adding the entities found there to the
current drawing. In this ca, DXFIN displays the message:
Not a new drawing -- only ENTITIES ction 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. Otherwi,
the newly added entities are drawn.
Auditing DXF Files
------------------
To ensure that corrupt data is not imported into your drawing, you
can instruct AutoCAD to perform an audit after importing DXF files
into your drawing with DXFIN. When you u DXFIN, the default action
is to perform no automatic
auditing. To activate automatic auditing,
u the CONFIG command:
Command: config
Your current AutoCAD configuration appears. Press 5 to continue.
From the Configuration menu lect this option:
7. Configure operating parameters
From the Operating parameter menu lect this option:
9. Automatic Audit after IGESIN, DXFIN, or DXBIN
Answer Y to this question:
Do you want an automatic audit after IGESIN, DXFIN, or DXBIN?
<N>: y
Return to the graphics screen by pressing 5 three times.
NOTE: This kind of audit only displays the errors AutoCAD finds; it
对话框英文
does not correct them. To correct problems, u the AUDIT command on
the drawing while you are in AutoCAD, or manually edit the DXF file.
DXF File Format
===============
This ction describes the format of a DXF file in detail. It
contains technical information that you need only if you write your
own programs to process DXF files or work with entity information
obtained by certain AutoLISP and ADS functions.
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 prented next.
General File Structure
-
---------------------
A Drawing Interchange File is simply an ASCII text file with a file
facebook是什么意思type of .dxf and specially formatted text. The overall organization
of a DXF file is as follows:
1. HEADER ction - General information about the drawing is found
in this ction of the DXF file. Each parameter has a variable
name and an associated value (e table 11-3 for a list of the
昆士兰大学header variables).
2. TABLES ction - This ction contains definitions of named
items.
o Linetype table (LTYPE)
o Layer table (LAYER)
o Text Style table (STYLE)
o View table (VIEW)
o Ur Coordinate System table (UCS)
o Viewport configuration table (VPORT)
o Dimension Style table (DIMSTYLE)
o Application Identification table (APPID)
3. BLOCKS ction - This ction contains Block Definition entities
describing the entities that make up each Block in the drawing.
4. ENTITIES ction - This ction contains the drawing entities,
including any Block References.
5. END OF FILE
If you u DXFOUT's Entities option, the resulting DXF file contains
only the ENTITIES ction and the END OF FILE marker, and the
ENTITIES ction reflects only the objects you lect for output.
NOTE: If you lect an INSERT entity, the corresponding Block
definition is not included in the output file.
A DXF file is compod of many 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 - that is,
right-justified and blank filled in a three-character field (the
exception to this is the four-digit extended entity data group
codes, which are output in FORTRAN I4). The cond line of t
he group
is the group value, in a format that depends on the type of group aite
specified by the group code. Although DXFOUT output has a fixed
format, the DXFIN format is free.
The specific assignment of group codes depends on 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:
Table 11-1. Group code ranges
+================================+
| Group code | Following value |
| range | |
|-------------|------------------|
| 0 - 9 | String |
|-------------|------------------|
| 10 - 59 | Floating-point |
|-------------|------------------|
| 60 - 79 | Integer |
|-------------|------------------|
| 140 - 147 | Floating-point |
|-------------|------------------|
| 170 - 175 | Integer |
|-------------|------------------|
| 210 - 239 | Floating-point |
|-------------|------------------|
| 999 | Comment (string) |
|-------------|------------------|
| 1010 - 1059 | Floating-point |
|-------------|------------------|
| 1060 - 1079 | Integer |
|-------------|------------------|
| 1000 - 1009 | String |
+--------------------------------+
Thus a program can easily read the value following a group code
without knowing the particular u of this group in an item in the
file. The appearance of values in the DXF file is not affected by
the tting of the UNITS command: coordinates are always reprented
as decimal (or possibly scientific notation if very large) numbers,
and angles are always reprented in decimal degrees with zero
degrees to the east of origin.
Variables, table entries, and entities are described by a group that
introduces 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 ud for file parators such as
markers for the beginning and end of ctions, tables, and the file
itlf.
Entities, table entries, and file parators are always introduced
with a 0 group code that is followed by a name describing the item.
NOTE: The maximum DXF file string length is 256 characters. If your
AutoCAD drawing contains strings that exceed this number, tho
strings are truncated during DXFOUT. If your DXF file contains
strings that exceed this number, DXFIN will fail.
Group Codes
-----------
Group codes are ud both to indicate the type of the value of the a lot of
group, as explained earlier, and to indicate the general u of the
group. The specific function of the group code depends on the actual
variable, table item, or entity description. This ction indicates
the general u of groups, noting as "(fixed)" any that always have
伤停补时
the same function.
Table 11-2. AutoCAD entity group codes (by number)
+===============================================================+
| Group code |
Value type |
|------------|--------------------------------------------------|
| 0 | Identifies the start of an entity, table entry, |起英文名字
| | or file parator. The type of entity is given |
| | by the text value that follows this group |
|------------|--------------------------------------------------|
| 1 | The primary text value for an entity |
|------------|--------------------------------------------------|
| 2 | A name: Attribute tag, Block name, and so on. |
| | Also ud to identify a DXF ction or table name|
|------------|--------------------------------------------------|
| 3-4 | Other textual or name values |
|------------|--------------------------------------------------|
| 5 | Entity handle expresd as a hexadecimal string |
| | (fixed) |
|------------|--------------------------------------------------|
| 6 | Line type name (fixed) |
|------------|--------------------------------------------------|
草莓的英文| 7 | Text style name (fixed) |
|------------|--------------------------------------------------|
| 8 | Layer name (fixed) |
|------------|--------------------------------------------------|
| 9 | Variable name identifier (ud only in HEADER |
| | ction 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 |
|------------|--------------------------------------------------|
| 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). |
| | Exists only in output from versions prior to R11 |
|------------|--------------------------------------------------|