1. Introduction
2. 2D
Geometry
3. 3D
Geometry
4. DXF
5. Display
6. Lists
7. Home
Copyright
(c) 1988-2009 Building Block Software, Inc. All rights reserved.
CAD/CAM
Developer's Kit/3D
Overview
========
The
Building Block Software CAD/CAM Developer's Kit / 3D (CCDK/3D) provides
functions
that enable your programs to read and
to write data in DXF format.
These functions are collectively called "CCDK/DXF".
DXF,
which stands for drawing interchange file, is a file format for
geometric
and other types of CAD/CAM data. Specified by Autodesk, Inc., it
has
become a standard in the PC-based CAD/CAM world. Nearly all PC-based
CAD/CAM
systems can read and write files in DXF format.
The two
primary uses for DXF files are: permanent data storage, and
communication
between CAD/CAM systems and other programs.
The
CCDK/DXF functions read and write files in the DXF format. These
routines
can read objects one at a time, or in batches.
They also can read
and
write in both ASCII and binary formats.
Fundamental
Concepts
====================
Introduction
------------
This
section describes DXF objects and operations without getting into any
programming
details. The purpose of this section is
to provide a basis for
the
sections of this reference that present programming information.
DXF
File Format
---------------
DXF
files consist of four sections:
*
HEADER
*
TABLES
*
BLOCKS
*
ENTITIES
The
HEADER section consists largely of drawing variables.
The
TABLES section contains a number of tables of:
* line
types
*
layers
* text
styles
* views
*
viewports
*
user-coordinate systems (UCSs)
The
BLOCKS section contains block definitions, which are groups of geometry,
text
and other drawing information that can be "inserted" in a drawing with
a
specified location, rotation and scale.
Each
block definition is composed of a header and a set of entities. The
entities
section of a block definition is organized
identically to the main
ENTITIES
section.
The
ENTITIES section contains geometry, text and other drawing information,
each
termed an entity.
All DXF
files must provide a minimal HEADER section and an ENTITIES section.
DXF
Objects
-----------
The
CCDK/DXF functions read and write four general types of data:
*
header variable
*
entity
* block
* table
entry
A
header variable is a variable in the HEADER section.
An
entity is any object in the ENTITIES section or in a block definition.
Entity
types include:
* POINT
* LINE
*
CIRCLE
* ARC
* TRACE
* SOLID
* TEXT
* SHAPE
*
INSERT
*
ATTDEF
*
ATTRIB
*
VERTEX
*
POLYLINE
*
LINE3D
*
FACE3D
*
DIMENSION
All of
these types are supported by CCDK/DXF.
A table
entry is an item in one of the tables.
Table
types include:
______________________________________________________________________________
|
Type |
Meaning |
|----------------------------------------------------------------------------|
|
LTYPE | line type |
|
LAYER |
layer |
|
STYLE |
text style |
|
VIEW | view |
|
UCS |
user coordinate system |
|
VPORT |
viewport |
------------------------------------------------------------------------------
The
order of tables in a DXF file does not matter, except that the line
types
table must precede the layers table.
All of
these types are supported by CCDK/DXF.
Formats
-------
CCDK/DXF
provides two in-memory formats for DXF data:
* DXF
*
internal
DXF
format is very similar to in-file DXF format, but is not convenient for
computations. It contains layer, color, and other non-geometric attributes
in
addition to geometry.
Internal
format is used by CCDK routines for computations. 2D and 3D curve
and
point entities may be converted to this format. It contains only
geometric
information.
In
addition, CCDK/DXF supports reading and writing using two in-file
formats:
* ASCII
*
binary
ASCII
is a human-readable format, where all information is stored as
ordinary
ASCII text.
Binary
is not human-readable, but requires substantially less space than
ASCII
to store the same amount of information.
DXF
Operations
--------------
This
section presents a summary of DXF operations provided by CCDK/DXF
functions.
DXF
operations are divided into four groups:
* file
* input
*
object creation
*
output
File
operations open and close DXF files, both for reading and writing, and
select
ASCII and binary formats. They also
control file position during
reading,
and the precision of data during writing.
Input
operations read entities, table entries
and block definitions, using
one of
three modes:
*
"one-shot"
*
"one-at-a-time"
*
"open-file"
The
"one-shot" mode opens a file, reads data, and closes the file. It
enables
programs to read entire DXF files with a single line of code.
The
"one-at-a-time" mode operates with an open file, reading one item at a
time. If each item is discarded before the next
one is read, large files
can be
read without requiring a large amount of memory.
The
"open-file" mode is a cross between these two modes. It enables
programs
to read batches of DXF objects from an open DXF file.
Input
operations that read entities use a filter to screen out objects that
do not
have a specified color, layer, or entity type.
CCDK/DXF
input operations also include insert explosion, which is a process
that
converts an insert entity into its constituent entities, applying the
transform
specified by the insert. Inserts may be
exploded one entity at a
time,
or with one call that generates a list of all
constituent entities.
Finally,
CCDK/DXF input operations for geometric entities include
conversions
from DXF format to Building Block Software's
internal format.
DXF
format is an in-memory format that
closely resembles the in-file format,
but
which is not convenient for
computations. The internal format, used
by
other
CCDK functions, is more suitable for
computations. CCDK/DXF also
provides
functions that combine reading curve and point entities from a DXF
file
and converting them into internal format.
Object
creation routines create DXF objects, usually in preparation to write
out
data to a DXF file. The types of
objects that may be created include
entities
(all types), table entries (all types), and
block definitions.
Output
operations, which write DXF data, also use the three modes used by
the
input operations.
The
output "one-shot" mode opens a file, writes data, and closes the file.
It
enables a DXF file to be written with a single line of code.
The
output "one-at-a-time" mode operates with an open file, writing one item
at a
time. If each item is discarded after
it is written and before the
next
item is created, large files can be built without requiring a large
amount
of memory.
The
output "open-file" mode is a cross between these two modes. It
enables
programs
to write batches of DXF objects to an open DXF file.
Geometry
in internal format may be converted into DXF format before writing,
or it
may be written directly from internal format, with the layer, color,
line
pattern, elevation and extrusion direction
specified by an entity
descriptor.
The
sections of a DXF file must follow the sequence: HEADER-TABLES-
BLOCKS-ENTITIES. Once data is entered into a section,
previous sections
cannot
be modified. CCDK/DXF provides
functions for opening and closing
section,
and for opening and closing tables and blocks
after data has been
written
in them.
Types
=====
Introduction
------------
This
section presents programming information about the objects defined in
CCDK/DXF. Use this section of the manual to locate the
names of object
types,
and the macros that access the attributes of these types.
DXF
Types Overview
------------------
The
types provided by CCDK/DXF include:
* DXF
file pointer
*
entities
*
filters and descriptors
* table
entries
*
blocks
A DXF
file pointer is an object that represents an open DXF file. It is used
both
for input and output.
Entities
are objects in the ENTITIES section and in the entities section of
block
definitions.
A
filter is a device used by input routines to exclude entities that do not
have
desired layer, color or type properties. A
descriptor is a device used
to
specify entity attributes when writing
curves and points in internal
format
directly to a DXF file.
Table
entries are elements of the tables in the TABLES section.
Blocks
are objects that record block definition header information, such as
name,
flags and block reference point.
The
sections below provide information about the type definitions provided
by
CCDK/DXF for representing and using these objects.
DXF
File Pointer
----------------
CCDK/DXF
provides an object that represents an open DXF
file:
______________________________________________________________________________
|
Type |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_FILE | a
DXF file pointer |
------------------------------------------------------------------------------
None of
the fields of the DXF_FILE object are public. Therefore no access
macros
are provided.
ENTITY
------
CCDK/DXF
provides one general object that represents
all entity types:
______________________________________________________________________________
|
Type |
Meaning |
|----------------------------------------------------------------------------|
| DXF_ENTITY | an entity |
------------------------------------------------------------------------------
The
following macros access information in a DXF_ENTITY object:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_ENTITY_LAYER(E) | a
STRING which specifies the name |
| | of the
layer of entity E |
|
DXF_ENTITY_HANDLE(E) | a
STRING which specifies the |
| | handle
of entity E |
|
DXF_ENTITY_LTYPE(E) | a
STRING which specifies the line |
| | type
name of entity E |
|
DXF_ENTITY_THICKNESS(E) | a
REAL which specifies the |
| |
thickness of entity E |
|
DXF_ENTITY_COLOR(E) |
an INT which specifies the color |
| | of
entity E |
|
DXF_ENTITY_EXTRUSION(E) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of entity E |
|
ion, |
@T2H = Macro Value |
------------------------------------------------------------------------------
POLYLINE,
LINE3D or FACE3D; FALSE otherwise
Also,
for each type of entity, there are macros that access properties
specific
to that type.
The
following access macros apply to LINE entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_LINE_PT0(L) |
an array of three REALs that |
| |
contains the x, y an z |
| | coordinates of the start point of |
| | LINE
entity L |
|
DXF_LINE_PT1(L) |
an array of three REALs that |
| |
contains the x, y and z |
| |
coordinates of the end point of |
| | LINE
entity L |
------------------------------------------------------------------------------
The
following access macros apply to POINT entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_POINT_PT(P) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of POINT entity P |
|
DXF_POINT_ANG(P) | a
REAL that specifies the angle of |
| | POINT
entity P |
------------------------------------------------------------------------------
The
following access macros apply to CIRCLE entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_CIRCLE_CTR(C) |
an array of three REALs that |
| |
specify the x, y and z |
| | coordinates of the center of |
| | CIRCLE
entity C |
|
DXF_CIRCLE_RAD(C) | a
REAL that specifies the radius |
| | of CIRCLE
entity C |
------------------------------------------------------------------------------
The
following access macros apply to ARC entities.
______________________________________________________________________________
| Macro | Meaning |
|----------------------------------------------------------------------------|
|
DXF_ARC_CTR(A) |
an array of three REALs that |
| | specify the x, y and z |
| |
coordinates of the center of ARC |
| | entity
A |
|
DXF_ARC_RAD(A) | a REAL that specifies the radius |
| | of ARC
entity A |
|
DXF_ARC_ANG0(A) | a
REAL that specifies the start |
| | angle
of ARC entity A |
|
DXF_ARC_ANG1(A) | a
REAL that specifies the end |
| | angle
of ARC entity A |
------------------------------------------------------------------------------
The
following access macros apply to TRACE entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_TRACE_PT0(T) |
an array of three REALs that |
| |
specify the x, y and z |
| | coordinates
of the first point of |
| | TRACE
entity T |
|
DXF_TRACE_PT1(T) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the secondpoint of |
| | TRACE
entity T |
|
DXF_TRACE_PT2(T) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the third point of |
| | TRACE
entity T |
|
DXF_TRACE_PT3(T) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the fourth point of |
| | TRACE entity T |
------------------------------------------------------------------------------
The
following access macros apply to SOLID entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_SOLID_PT0(S) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the first point of |
| | SOLID
entity S |
|
DXF_SOLID_PT1(S) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the second point of |
| | SOLID entity S |
|
DXF_SOLID_PT2(S) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the third point of |
| | SOLID
entity S |
|
DXF_SOLID_PT3(S) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the fourth point of |
| | SOLID
entity S |
------------------------------------------------------------------------------
The
following access macros apply to TEXT entities.
______________________________________________________________________________
|
Macro |
Use |
|----------------------------------------------------------------------------|
|
DXF_TEXT_INS_PT(T) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the insertion point |
| | of
TEXT entity T |
|
DXF_TEXT_HEIGHT(T) | a
REAL that specifies the height |
| | of
TEXT entity T |
|
DXF_TEXT_VALUE(T) | a
STRING that specifies the text |
| | of
TEXT entity T |
|
DXF_TEXT_ROT_ANG(T) | a
REAL that specifies the rotation |
| | angle of TEXT entity T |
|
DXF_TEXT_X_SCALE(T) | a
REAL that specifies the x-scale |
| | of
TEXT entity T |
|
DXF_TEXT_OBL_ANG(T) | a REAL that specifies
the |
| |
obliquing angle of TEXT entity T |
|
DXF_TEXT_STYLE(T) | a
STRING that specifies the name |
| | of the
text style of TEXT entity |
| | T;
text style names can be found |
| | in the
STYLE table |
|
DXF_TEXT_FLAGS(T) |
an INT that specifies options of |
| | TEXT
entity T |
|
DXF_TEXT_JUST(T) |
an INT that specifies |
| |
justification of TEXT entity T |
|
DXF_TEXT_AL_PT(T) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the alignment point |
| | of TEXT entity T |
------------------------------------------------------------------------------
Valid
options for text flags include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_TEXT_X_MIRR |
text is mirrored in x-direction |
|
DXF_TEXT_Y_MIRR |
text is mirrored in y-direction |
|
DXF_TEXT_LJUST |
text is left justified |
|
DXF_TEXT_CNTRD |
text is centered |
|
DXF_TEXT_RJUST |
text is right justified |
|
DXF_TEXT_ALIGNED |
text is aligned between placement |
| | point
and alignment point; width |
| | and height is adjusted |
|
DXF_TEXT_MID_CTRD |
text is centered both vertically |
| | and
horizontally about a point |
|
DXF_TEXT_FIT |
text is fit between two points; |
| | only
width is adjusted |
------------------------------------------------------------------------------
The
following access macros apply to SHAPE entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_SHAPE_INS_PT(S) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the insertion point |
| | of SHAPE entity S |
|
DXF_SHAPE_SIZE(S) | a
REAL that specifies the size of |
| | SHAPE
entity S |
|
DXF_SHAPE_NAME(S) | a
STRING that specifies the name |
| | of
SHAPE entity S |
|
DXF_SHAPE_ROT_ANG(S) | a
REAL that specifies the rotation |
| | angle,
in degrees, of SHAPE |
| | entity
S |
|
DXF_SHAPE_X_SCALE(S) | a
REAL that specifies the x-scale |
| | of
SHAPE entity S |
| DXF_SHAPE_OBL_ANG(S) | a REAL that specifies, in
degrees, |
| | the
obliquing angle of SHAPE |
| | entity
S |
------------------------------------------------------------------------------
The
following access macros apply to INSERT entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_INSERT_FLAGS(I) |
an INT that, if equal to 1, |
| |
specifies that INSERT entity I |
| | has
attributes |
|
DXF_INSERT_BLOCK(I) | a
STRING that specifies the name |
| | of the
block referenced by INSERT |
| | entity I |
|
DXF_INSERT_PT(I) | a
REAL that specifies the |
| |
insertion point of INSERT entity |
| | I |
|
DXF_INSERT_X_SCALE(I) | a
REAL that specifies the x-scale |
| | of
INSERT entity I |
|
DXF_INSERT_Y_SCALE(I) | a
REAL that specifies the y-scale |
| | of
INSERT entity I |
|
DXF_INSERT_Z_SCALE(I) | a
REAL that specifies the z-scale |
| | of
INSERT entity I |
|
DXF_INSERT_ROT_ANG(I) | a
REAL that specified the rotation |
| | angle
of INSERT entity I |
|
DXF_INSERT_COLS_CNT(I) |
an INT that specifies the number |
| | of
columns in arrayed INSERT |
| | entity
I |
|
DXF_INSERT_ROWS_CNT(I) |
an INT that specifies the number |
| | of rows in arrayed INSERT entity
|
| | I |
|
DXF_INSERT_COL_SPC(I) | a
REAL that specifies the distance |
| | between columns in
arrayed INSERT |
| | I |
|
DXF_INSERT_ROW_SPC(I) | a
REAL that specifies the distance |
| |
between rows in arrayed INSERT I |
|
DXF_INSERT_ATTRS(I) | a
DML_LIST which contains the |
| | ATTRIB
entities of INSERT |
| |
entities I |
------------------------------------------------------------------------------
The
following access macros apply to ATTDEF entities.
______________________________________________________________________________
|
Macro | Meaning |
|----------------------------------------------------------------------------|
|
DXF_ATTDEF_PT(A) |
an array of three REALs which is |
| | the tag text location of ATTDEF
|
| | entity
A |
|
DXF_ATTDEF_HEIGHT(A) | a
REAL which is the height of the |
| | tag text
of ATTDEF entity A |
|
DXF_ATTDEF_VALUE(A) | a
STRING which is the value stored |
| | in
ATTDEF entity A |
|
DXF_ATTDEF_PROMPT(A) | a
STRING which is the prompt |
| | issued
when the value of ATTDEF |
| | entity
A is set |
|
DXF_ATTDEF_TAG(A) | a
STRING which contains the text |
| | of the
tag of ATTDEF entity A |
|
DXF_ATTDEF_AFLAGS(A) |
an INT that specify attribute |
| |
properties; see table below for |
| | options |
|
DXF_ATTDEF_FLD_LEN(A) |
an INT which specifies the value |
| | field
length of ATDDEF entity A |
|
DXF_ATTDEF_ROT_ANG(A) | a REAL which is the rotation
angle |
| | in
degrees of ATTDEF entity A |
|
DXF_ATTDEF_X_SCALE(A) | a
REAL which is the relative |
| | x-scale
of ATTDEF entity A |
|
DXF_ATTDEF_OBL_ANG(A) | a
REAL which is the obliquing |
| | angle
in degrees of ATTDEF entity |
| | A |
|
DXF_ATTDEF_STYLE(A) | a
STRING which specifies the text |
| | style
name of ATTDEF entity A |
|
DXF_ATTDEF_GFLAGS(A) |
an INT that specifies text |
| |
generation flags; see TEXT |
| |
entities for valid options |
|
DXF_ATTDEF_JUST(A) |
an INT which specifies |
| | justification type |
|
DXF_ATTDEF_AL_PT(A) |
an array of three REALs which |
| |
specifies an alignment point used |
| | in some text generation modes |
------------------------------------------------------------------------------
Valid
options for ATTDEF flags include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_ATTDEF_INVIS |
attribute text is invisible |
|
DXF_ATTDEF_IS_CONST |
attribute value is constant |
|
DXF_ATTDEF_VER_REQ |
setting attribute value requires |
| |
verification |
|
DXF_ATTDEF_IS_PRESET | use default value of ATTDEF when |
| |
creating ATTRIB |
------------------------------------------------------------------------------
These
options may be combined with the | operator.
The
following access macros apply to ATTRIB entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_ATTRIB_PT(A) |
an array of three REALs which is |
| | the
tag text location of ATTRIB |
| | entity
A |
|
DXF_ATTRIB_HEIGHT(A) | a
REAL which is the height of the |
| | tag
text of ATTRIB entity A |
|
DXF_ATTRIB_VALUE(A) | a
STRING which is the value stored |
| | in
ATTRIB entity A |
|
DXF_ATTRIB_PROMPT(A) | a
STRING which is the prompt |
| | issued
when the value of ATTRIB |
| | entity
A is set |
|
DXF_ATTRIB_TAG(A) | a
STRING which contains the text |
| | of the
tag of ATTRIB entity A |
|
DXF_ATTRIB_AFLAGS(A) |
an INT that specify attribute |
| |
properties; see table below for |
| |
options |
|
DXF_ATTRIB_FLD_LEN(A) | an INT which specifies the
value |
| | field
length of ATTRIB entity A |
|
DXF_ATTRIB_ROT_ANG(A) | a
REAL which is the rotation angle |
| | in degrees
of ATTRIB entity A |
|
DXF_ATTRIB_X_SCALE(A) | a
REAL which is the relative |
| |
x-scale of ATTRIB entity A |
|
DXF_ATTRIB_OBL_ANG(A) | a
REAL which is the obliquing |
| | angle
in degrees of ATTRIB entity |
| | A |
|
DXF_ATTRIB_STYLE(A) | a
STRING which specifies the text |
| | style
name of ATTRIB entity A |
|
DXF_ATTRIB_GFLAGS(A) |
an INT that specifies text |
| |
generation flags; see TEXT |
| | entities
for valid options |
|
DXF_ATTRIB_JUST(A) |
an INT which specifies |
| |
justification type |
|
DXF_ATTRIB_AL_PT(A) | an array of three REALs which |
| |
specifies an alignment point used |
| | in
some text generation modes |
------------------------------------------------------------------------------
Valid
options for ATTRIB flags include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_ATTRIB_INVIS |
attribute text is invisible |
|
DXF_ATTRIB_IS_CONST |
attribute value is constant |
|
DXF_ATTRIB_VER_REQ | setting attribute value requires |
| |
verification |
|
DXF_ATTRIB_IS_PRESET |
ATTRIB was created using default |
| | value
of template ATTDEF |
------------------------------------------------------------------------------
These
options may be combined with the bitwise-or (|) operator.
The
following access macros apply to VERTEX entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_VERTEX_PT(V) | an array of three REALs which |
| |
specifies the coordinates of |
| | VERTEX
entity V |
|
DXF_VERTEX_W0(V) | a
REAL which specifies the |
| |
starting width of the segment |
| |
following the vertex |
|
DXF_VERTEX_W1(V) | a
REAL which specifies the ending |
| | width
of the segment following |
| | the
vertex |
|
DXF_VERTEX_BULGE(V) | a
REAL which specifies the "bulge"
|
| | of an arc segment; the bulge is
|
| | the
tangent of one-fourth of the |
| | arc
sweep; it is positive if the |
| | arc is counter-clockwise, and |
| |
negative if the arc is clockwise |
|
DXF_VERTEX_FLAGS(V) |
an INT that specify properties of |
| | VERTEX entity V; see table below
|
| | for
options |
|
DXF_VERTEX_TAN(V) | a
REAL that specifies the slope at |
| | the
vertex of the segment |
| |
following the vertex; this |
| |
quantity is expressed in degrees |
------------------------------------------------------------------------------
Valid
options for vertex flags include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_VERTEX_FIT |
extra vertex for curve fitting |
|
DXF_VERTEX_TAN_DEF | a
tangent direction is defined for |
| | this
vertex |
|
DXF_VERTEX_SPL_FIT |
spline fit vertex |
|
DXF_VERTEX_SPL_FR |
spline control point |
|
DXF_VERTEX_3D_PLINE |
3D polyline vertex |
|
DXF_VERTEX_3D_MESH |
3D mesh vertex |
------------------------------------------------------------------------------
The
following access macros apply to POLYLINE entities. have type :
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_PLINE_VFLAG(P) | an INT which indicates whether
or |
| | not
POLYLINE entity P has VERTEX |
| |
entities; a value of 1 means that |
| | there
are VERTEX entities |
|
DXF_PLINE_FLAGS(P) |
an INT that specifies polyline |
| |
properties of POLYLINE entity P; |
| | see
table below for options |
|
DXF_PLINE_W0(P) | a
REAL which specifies the |
| |
starting width of POLYLINE entity |
| | P |
|
DXF_PLINE_W1(P) | a
REAL which specifies the ending |
| | width
of the first segment of the |
| |
POLYLINE entity |
|
DXF_PLINE_M_CNT(P) |
an INT which specifies the number |
| | of
rows in the mesh represented |
| | by
POLYLINE entity P |
|
DXF_PLINE_N_CNT(P) | an INT which specifies the
number |
| | of
columns in the mesh represented |
| | by POLYLINE entity P |
|
DXF_PLINE_M_DENS(P) |
an INT which specifies the surface |
| | mesh
density in the M direction |
|
DXF_PLINE_N_DENS(P) |
an INT which specifies the surface |
| | mesh
density in the N direction |
|
DXF_PLINE_TYPE(P) |
an INT which specifies polyline |
| | type
of POLYLINE entity P when it |
| |
represents a mesh; see table below |
| | for
options |
|
DXF_PLINE_VLIST(P) | a
DML_LIST which contains all of |
| | the
VERTEX entities in POLYLINE |
| | entity P |
------------------------------------------------------------------------------
Valid
options for polyline flags include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_PLINE_CLSD |
polyline is closed |
|
DXF_PLINE_FIT |
arcs are fit through the polyline |
| |
points |
|
DXF_PLINE_SPL_FIT | a
spline is fit through the |
| | polyline points |
|
DXF_PLINE_3D |
3D polyline |
|
DXF_PLINE_3D_MESH |
3D mesh |
|
DXF_PLINE_CLSD_N | 3D mesh is closed in the N |
| |
direction |
------------------------------------------------------------------------------
Valid
options for polyline type include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_PLINE_NSMOOTH |
faceted surface |
|
DXF_PLINE_QUADR |
quadratic interpolation |
|
DXF_PLINE_CUBIC |
cubic interpolation |
|
DXF_PLINE_BEZIER | Bezier interpolation |
------------------------------------------------------------------------------
The
following access macros apply to LINE3D entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_LINE3D_PT0(L) |
an array of three REALs which |
| | represents the start point
of |
| | LINE3D
entity L |
|
DXF_LINE3D_PT1(L) |
an array of three REALs which |
| | represents the end point of |
| | LINE3D
entity L |
------------------------------------------------------------------------------
The
following access macros apply to FACE3D entities.
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_FACE3D_PT0(F) |
an array of three REALs which |
| |
specifies the first point of |
| | FACE3D
entity F |
|
DXF_FACE3D_PT1(F) |
an array of three REALs which |
| |
specifies the second point of |
| | FACE3D
entity F |
|
DXF_FACE3D_PT2(F) | an array of three REALs
which |
| |
specifies the third point of |
| | FACE3D
entity F |
|
DXF_FACE3D_PT3(F) | an
array of three REALs which |
| |
specifies the fourth point of |
| | FACE3D
entity F |
|
DXF_FACE3D_FLAGS(F) |
an INT that specifies visibility |
| | of the
edges of FACE3D entity F |
------------------------------------------------------------------------------
Valid
options for FACE3D flags include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_FACE3D_E1_INVIS |
if TRUE, first edge is invisible |
|
DXF_FACE3D_E2_INVIS |
if TRUE, second edge is invisible |
|
DXF_FACE3D_E3_INVIS |
if TRUE, third edge is invisible |
|
DXF_FACE3D_E4_INVIS |
if TRUE, fourth edge is invisible |
------------------------------------------------------------------------------
The
following access macros apply to DIM entities.
______________________________________________________________________________
|
Macro | Meaning |
|----------------------------------------------------------------------------|
|
DXF_DIM_NAME(D) | a
STRING that specifies the name |
| | of the pseudo-block that contains
|
| | the
picture of DIMENSION entity D |
|
DXF_DIM_DEF_PT(D) |
an array of three REALs which |
| |
specifies the definition point of |
| |
DIMENSION entity D |
|
DXF_DIM_MID_PT(D) |
an array of three REALs which |
| |
specifies the middle point of the |
| | text
of DIMENSION entity D |
|
DXF_DIM_INS_PT(D) |
an array of three REALs which |
| |
specifies the insertion point of |
| | dimension clones of
DIMENSION |
| | entity
D |
|
DXF_DIM_TYPE(D) |
an INT which specifies the type of |
| | DIMENSION entity D; see table
|
| | below
for options |
|
DXF_DIM_TEXT(D) | a
STRING which specifies the text |
| | of DIMENSION entity D |
|
DXF_DIM_DEF_PT3(D) |
an array of three REALs which |
| |
specifies a defintion point for |
| | linear
and angular dimensions |
|
DXF_DIM_DEF_PT4(D) |
an array of three REALs which |
| |
specifies a definition point for |
| |
angular dimensions |
|
DXF_DIM_DEF_PT5(D) |
an array of three REALs which |
| |
specifies a defintion point for |
| |
diameter, radial and angular |
| | dimensions |
|
DXF_DIM_DEF_PT6(D) |
an array of three REALs which |
| |
specifies a definition point for |
| | angular dimensions |
|
DXF_DIM_LDR_LEN(D) | a
REAL which specifies the leader |
| | length
of DIMENSION entity D |
|
DXF_DIM_ANG(D) | a REAL which specifies the angle |
| | of
horizontal, vertical and |
| |
rotated dimensions |
|
DXF_DIM_HORIZ(D) | a
REAL which specifies the angle |
| | to be
considered horizontal for |
| |
DIMENSION entity D |
------------------------------------------------------------------------------
Valid
options for dimension types include:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_DIM_STANDARD |
horizontal, vertical or rotated |
|
DXF_DIM_ALIGNED |
aligned |
|
DXF_DIM_ANGULAR |
angular |
|
DXF_DIM_DIAMETER |
diameter |
|
DXF_DIM_RADIUS |
radial |
------------------------------------------------------------------------------
Filters
-------
Filters
are devices used by CCDK/DXF input routines to screen out entities
that do
not have desired types, colors and layers.
The
following type defines a filter:
______________________________________________________________________________
|
Type |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_FILTER | a
filter |
------------------------------------------------------------------------------
The
following macros access filter attributes:
______________________________________________________________________________
|
Macro | Meaning |
|----------------------------------------------------------------------------|
|
DXF_FILTER_TYPE(F) | a
unsigned int which specifies the |
| | entity
types that filter F will |
| | allow;
see type constants below |
|
DXF_FILTER_LAYER(F) | a
STRING which specifies the layer |
| | from
which entities are to be |
| |
read |
|
DXF_FILTER_COLOR(F) |
an INT which specifies the entity |
| | colors
that filter F will allow; |
| | see
color constants below |
------------------------------------------------------------------------------
The
following constants specify entity types:
______________________________________________________________________________
|
Value |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_POINT |
POINT entity |
|
DXF_LINE |
LINE entity |
|
DXF_CIRCLE |
CIRCLE entity |
|
DXF_ARC |
ARC entity |
|
DXF_TRACE |
TRACE entity |
|
DXF_SOLID |
SOLID entity |
|
DXF_POLYLINE |
POLYLINE entity |
|
DXF_LINE3D |
LINE3D entity |
|
DXF_FACE3D |
FACE3D entity |
|
DXF_TEXT |
TEXT entity |
|
DXF_SHAPE | SHAPE entity |
|
DXF_INSERT |
INSERT entity |
|
DXF_ATTDEF |
ATTDEF entity |
|
DXF_DIM |
DIM entity |
|
DXF_ALL_TYPES |
all entity types |
|
DXF_CURVE |
LINE, ARC, CIRCLE, TRACE, SOLID, |
| |
POLYLINE, LINE3D, and FACE3D |
| |
entities |
------------------------------------------------------------------------------
Constants
for entity types may be combined using the bitwise-or operator.
______________________________________________________________________________
|
Value |
Meaning |
|----------------------------------------------------------------------------|
|
0-15 | DXF color codes |
|
DXF_ANY_COLOR |
allow any color |
------------------------------------------------------------------------------
Entity
Descriptor
-----------------
Descriptors
are devices used by CCDK/DXF output routines to specify entity
properties.
The
following type defines a descriptor:
______________________________________________________________________________
|
Type | Meaning |
|----------------------------------------------------------------------------|
|
DXF_ENTITY_DESC |
an entity descriptor used to |
| | specify
layer, handle, line |
| |
pattern name, elevation, |
| |
thickness, color, and extrusion |
| |
direction when writing curves and |
| |
points |
------------------------------------------------------------------------------
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_DESC_LAYER(D) | a
STRING in descriptor D that |
| | specifies layer name |
|
DXF_DESC_HANDLE(D) | a
STRING in descriptor D that |
| |
specifies entity handle |
|
DXF_DESC_LTYPE(D) | a STRING in descriptor D
that |
| |
specifies line type name |
|
DXF_DESC_ELEVATION(D) | a
REAL in descriptor D that |
| | specifies
entity elevation |
|
DXF_DESC_THICKNESS(D) | a
REAL in descriptor D that |
| |
specifies entity thickness |
|
DXF_DESC_COLOR(D) |
an INT in descriptor D that |
| |
specifies entity color |
|
DXF_DESC_EXTRUSION(D) |
an array of three REALs in |
| |
descriptor D that specifies |
| | entity
extrusion direction |
------------------------------------------------------------------------------
Table
Entries
-------------
The
following type defines a table entry:
______________________________________________________________________________
|
Type |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_TABLE_ENTRY | a table entry |
------------------------------------------------------------------------------
The
following macros access the attributes of LTYPE table entries:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_LTYPE_NAME(L) | a
STRING that specifies the name |
| | of
LTYPE table entry L |
|
DXF_LTYPE_FLAGS(L) |
an INT; if equal to 64, indicates |
| | that
LTYPE table entry L is |
| |
referenced by an entity |
|
DXF_LTYPE_TEXT(L) | a
STRING which contains |
| |
descriptive text in LTYPE table |
| | entry
L |
|
DXF_LTYPE_ALGN(L) |
an INT which specifies the |
| |
alignment code of LTYPE table |
| | entry
L |
|
DXF_LTYPE_CNT(L) |
an INT which specifies the number |
| | of
dashes in the pattern in LTYPE |
| | table
entry L |
|
DXF_LTYPE_TOT_LEN(L) | a
REAL which specifies the total |
| | length
of the pattern in LTYPE |
| | table
entry L |
|
DXF_LTYPE_LEN(L) |
an array of REALs which specify |
| | the
lengths of each of the dashes |
| | in the
pattern in LTYPE table |
| | entry
L |
------------------------------------------------------------------------------
The
following macros access attributes of LAYER table entries:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_LAYER_NAME(L) | a
STRING which specifies the layer |
| | name
in LAYER table entry L |
|
DXF_LAYER_FLAGS(L) |
an INT; if equal to 64, indicates |
| | that
LAYER table entry L is |
| |
referenced by an entity |
|
DXF_LAYER_COLOR(L) |
an INT which specifies layer color |
| | in
LAYER table entry L |
|
DXF_LAYER_LTYPE(L) | a
STRING which specifies linetype |
| | name
in LAYER table entry L |
------------------------------------------------------------------------------
The
following macros access attributes of STYLE table entries:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_STYLE_NAME(S) | a
STRING which specifies the style |
| | name
in STYLE table entry S |
|
DXF_STYLE_FLAGS(S) |
an INT; if set to 64, the table |
| | entry
is referenced by an entity; |
| | if the
first bit is set, the style |
| | refers
to a shape file specified |
| | by the
style name |
|
DXF_STYLE_HEIGHT(S) | a
REAL which specifies the text |
| | height
in STYLE table entry S |
|
DXF_STYLE_WIDTH(S) | a
REAL which specifies text width |
| | in
SYTLE table entry S |
|
DXF_STYLE_OBL_ANG(S) | a
REAL which specifies obliquing |
| | angle in SYTLE table
entry S |
|
DXF_STYLE_GFLAGS(S) |
an INT; a value of 2 denotes |
| |
backwards text; a value of 4 |
| |
denotes upside-down text; a value |
| | of 6
denotes both |
|
DXF_STYLE_LAST_HT(S) | a
REAL which specifies the default |
| |
height; it is the last value used |
| | with
the style |
|
DXF_STYLE_FONT(S) | a
STRING that contains the name of |
| | the
font file |
|
DXF_STYLE_BIGFONT(S) | a
STRING that contains the name of |
| | the
"big-font" font file |
------------------------------------------------------------------------------
The following
macros access attributes of VIEW table
entries:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_VIEW_NAME(V) | a
STRING which specifies view name |
| | of
VIEW table entry V |
|
DXF_VIEW_HEIGHT(V) |
an INT which specifies view height |
| | of
VIEW table entry V |
|
DXF_VIEW_WIDTH(V) | a
REAL which specifies view width |
| | of
VIEW table entry V |
|
DXF_VIEW_CTR(V) |
array of two REALs which specify |
| | the
view center point of VIEW
|
| | table
entry V |
| DXF_VIEW_DIR(V) | array of three REALs
which specify |
| | the
view direction of VIEW table |
| | entry
V |
|
DXF_VIEW_TGT_PT(V) |
array of three REALs which specify |
| | the
view target point of VIEW |
| | table
entry V |
|
DXF_VIEW_LENS_LEN(V) | a REAL which specifies the lens |
| | length
of VIEW table entry V |
|
DXF_VIEW_FR_CLIP(V) | a
REAL which specifies the front |
| |
clipping distance of VIEW table |
| | entry
V |
|
DXF_VIEW_BK_CLIP(V) | a
REAL which specifies the back |
| |
clipping distance of VIEW table |
| | entry
V |
|
DXF_VIEW_TWIST(V) | a
REAL which specifies the twist |
| | angle
of VIEW table entry V |
| DXF_VIEW_MODE(V) | an INT which specifies
the view |
| | mode
of VIEW table entry V |
------------------------------------------------------------------------------
The
following macros access the attributes of UCS table entries:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_UCS_NAME(S) | a
STRING which specifies the name |
| | of UCS
table entry S |
|
DXF_UCS_FLAGS(S) |
an INT; if equal to 64, then UCS |
| | table
entry S is referenced by an |
| |
entity |
|
DXF_UCS_ORIGIN(S) |
array of three REALs which |
| |
specifies the origin of UCS table |
| | entry
S |
|
DXF_UCS_X_AXIS(S) |
array of three REALs which |
| | specifies the x-axis of UCS table |
| | entry
S |
|
DXF_UCS_Y_AXIS(S) |
array of three REALs which |
| | specifies the y-axis of UCS table
|
| | entry
S |
------------------------------------------------------------------------------
The
following macros access attributes of VPORT table entries:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_VP_NAME(P) | a
STRING which specifies the name |
| | of
VPORT table entry P |
|
DXF_VP_LL(P) |
an array of two REALs which |
| | specifies the lower left
screen |
| | corner
of VPORT table entry P |
|
DXF_VP_UR(P) |
an array of two REALs which |
| | specifies the upper right
screen |
| | corner
of VPORT table entry P |
|
DXF_VP_CTR(P) |
an array of two REALs which |
| |
specifies the center of VPORT |
| | table
entry P |
|
DXF_VP_SNAP_BPT(P) |
array of two REALs which specifies |
| | the
snap base point of VPORT |
| | table
entry P |
|
DXF_VP_SNAP_SPC(P) |
array of two REALs whic specifies |
| | the
horizontal and vertical |
| |
snapping distance of VPORT table |
| | entry
P |
|
DXF_VP_GRID_SPC(P) |
array of two REALs which specifies |
| | the horizontal and vertical grid
|
| |
spacing of VPORT table entry P |
|
DXF_VP_DIR(P) |
array of three REALs that |
| | specifies the viewing
direction |
| | of
VPORT table entry P |
|
DXF_VP_TGT_PT(P) |
array of three REALs that |
| |
specifies the viewing point of |
| |
VPORT table entry P |
|
DXF_VP_HEIGHT(P) | a
REAL that specifies the height |
| | of
VPORT table entry P |
|
DXF_VP_AR(P) | a
REAL that specifies the aspect |
| | ratio
of VPORT table entry P |
|
DXF_VP_LENS_LEN(P) | a
REAL that specifies the lens |
| | length
of VPORT table entry P |
|
DXF_VP_FR_CLIP(P) | a
REAL that specifies the front |
| | clip
distance of VPORT table |
| | entry P |
|
DXF_VP_BK_CLIP(P) | a
REAL that specifies the back |
| | clip
distance of VPORT table |
| | entry P |
|
DXF_VP_SNAP_ANG(P) | a
REAL that specifies the snap |
| |
rotation of VPORT table entry P |
|
DXF_VP_TWIST(P) | a
REAL that specifies the twist |
| | angle
of VPORT table entry P |
|
DXF_VP_MODE(P) |
an INT that specifies view mode of |
| | VPORT
table entry P |
|
DXF_VP_CZOOM(P) |
an INT that specifies circle zoom |
| |
percentage |
|
DXF_VP_FZOOM(P) |
an INT that specifies fast zoom |
|
DXF_VP_UCSICON(P) |
an INT that specifies the |
| |
appearance of the UCS icon |
|
DXF_VP_SNAP(P) |
an INT which specifies whether |
| | snap is on or off |
|
DXF_VP_GRID(P) |
an INT which specifies whether the |
| | grid
is on or off |
|
DXF_VP_SNAP_STYLE(P) | an INT which specifies snap
style |
|
DXF_VP_SNAP_ISOPAIR(P) |
an INT which specifies the current |
| | plane
for snapping |
------------------------------------------------------------------------------
Block
-----
The
following type defines a block header record:
______________________________________________________________________________
|
Type |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_BLOCK | a
block header record |
------------------------------------------------------------------------------
The
following macros access the attributes of block header records:
______________________________________________________________________________
|
Macro |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_BLOCK_NAME(B) | a
STRING which specifies the name |
| | of
block B |
|
DXF_BLOCK_FLAGS(B) |
an INT which specifies options of |
| | block
B |
|
DXF_BLOCK_BASE_PT(B) |
an array of three REALs that |
| |
specify the x, y and z |
| |
coordinates of the base point of |
| | block
B |
------------------------------------------------------------------------------
Valid
options for block flags, which may be combined
with the bitwise or
operator,
are:
______________________________________________________________________________
|
Option |
Meaning |
|----------------------------------------------------------------------------|
|
DXF_BLOCK_IS_ANON |
anonymous block created by |
| |
hatching or dimensioning |
| DXF_BLOCK_HAS_ATTR | attributes exist in this
block |
------------------------------------------------------------------------------
Functions
By Category
=====================
Introduction
------------
This
section presents the CCDK/DXF functions grouped by the type of
operation
they perform.
Category
Overview
-----------------
DXF
functions and macros are divided into four categories:
* file
* input
*
creating DXF objects
*
output
The
file functions open, close, set file position, and control precision of
output
data.
The
input functions handle all reading operations, including insert
explosion.
The
functions that create DXF objects build and modify DXF objects.
The
output functions write entities, table entries, and blocks.
Input
and output occurs in one of three modes:
*
one-shot
*
one-at-a-time
*
open-file
The
one-shot mode is used to read or to write a DXF file in one pass, such
as when
extracting all geometry from a file, or when
saving the results of
geometric
constructions. These functions
make programming easier by
enabling
programmers to access DXF files with
one line of code.
The
one-at-a-time mode is used to reduce the amount of memory needed to read
or to
write a file. These functions require
only the entity being read or
written
to be in memory, while the one- shot DXF functions require all the
entities
to be in memory at once.
The
open-file mode is a combination of the one-shot and the one-at-a-time
modes. These functions read and write lists of information with one call.
Although
this mode requires somewhat more memory
than the one-at-a-time
mode,
it does not require an amount as large
as a call to a one-shot
function would require.
The
File functions are divided into the
following groups:
*
open/close
* file
position
*
precision
The
open/close functions open DXF files for reading and writing, and close
them
afterwards.
The
file position operations are used for recording and setting start
positions
for one-at-a-time input operations.
Precision
functions control output precision.
The
Input functions are divided into the
following groups:
*
filter
*
one-shot
*
one-at-a-time
*
open-file
*
explode inserts
*
conversion from DXF format to internal format
Filter
routines create and maintain filters used by input routines to screen
out
entities that do not satisfy layer, color and
type specifications.
The
one-shot, one-at-a-time, and open-file
functions read data using
respective
modes.
The
explode inserts functions expand inserts into their constituent
entities.
The
conversion routines convert DXF data into internal format.
The
functions that create DXF objects are
divided into the following groups:
*
entities
*
entity properties
* table
entries
The
entities functions create entities with specified properties.
The
entity properties functions get and set entity
properties.
The table
entries routines create table entries with
specified properties.
The
Output functions are divided into the
following groups:
*
section open/close
*
conversion from internal format to DXF
*
one-shot
*
one-at-a-time
*
open-file
The
section open/close functions open and close the HEADER, TABLES, BLOCKS
and
ENTITIES sections for writing.
The
conversion routines convert data in internal format to DXF format in
preparation
for writing it to a DXF file.
The
one-shot, one-at-a-time, and open-file
routines write data to a DXF file
using
their respective modes.
Function
Prefixes
-----------------
The
following table lists function prefixes used in CCDK/DXF, and the
meaning
of each prefix:
and
convert between DXF format and 2D internal format
and
convert between DXF format and 3D internal format
Use
prefixes to determine which header files should be included when using a
function.
For example, when using dx2_read_curves,
include dx2defs.h.
File
----
The
following functions open and close DXF files:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_fopen |
to open a DXF file |
|
dxf_get_filepos |
to get the current position in a |
| | DXF
file |
|
dxf_set_filepos |
to set the current position in a |
| | DXF
file; used only when reading |
|
dxf_fclose |
to close a DXF file |
------------------------------------------------------------------------------
The
following functions get and set the precision of output:
______________________________________________________________________________
|
Function | Use |
|----------------------------------------------------------------------------|
|
dxf_get_precision |
to get the output precision |
|
dxf_set_precision | to set the output precision |
------------------------------------------------------------------------------
Input
-----
The
following functions manage input filters:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_create_filter |
to create a filter |
|
dxf_filter_set_color |
to set filter color |
|
dxf_filter_set_layer |
to set filter layer |
|
dxf_filter_set_type |
to set filter type |
|
dxf_filter_add_type |
to add an entity type to a filter |
|
dxf_free_filter |
to free a filter |
------------------------------------------------------------------------------
The
following functions use the one-shot mode to read information from a DXF
file:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_read_entities |
to read a list of entities from a |
| | DXF
file |
|
dxf_read_blocks |
to read a list of block headers |
| | from a
DXF file |
|
dxf_read_table_entries |
to read a list of table entries |
| | from a
DXF file |
|
dx2_read_curves |
to read a list of 2D curves from a |
| | DXF
file |
|
dx2_read_points |
to read a list of 2D points from a |
| | DXF file |
|
dx3_read_curves |
to read a list of 3D curves from a |
| | DXF
file |
|
dx3_read_points | to read a list of 3D points
from a |
| | DXF
file |
------------------------------------------------------------------------------
The
following functions use the one-at-a-time mode to read information from
a DXF
file:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_get_entity |
to get an entity from a DXF file |
|
dxf_get_hdr_var |
to get the value of a header |
| |
variable |
|
dxf_hdr_var_sizeof |
to compute the size in bytes of a |
| | header
variable |
|
dxf_get_block |
to get a block header from a DXF |
| |
file |
|
dxf_block_base_pt |
to get a block base point from a |
| | DXF
file |
|
dxf_free_block |
to free a block header record |
|
dxf_get_table_entry |
to get a table entry from a DXF |
| |
file |
|
dx2_get_curve | to get a 2D curve from a DXF
file |
|
dx2_get_point |
to get a 2D point from a DXF file |
|
dx3_get_curve |
to get a 3D curve from a DXF file |
|
dx3_get_point |
to get a 3D point from a DXF file |
------------------------------------------------------------------------------
The
following functions use the open-file mode to read information from a
DXF
file:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_get_entities |
to get a list of entities from a |
| | DXF
file |
|
dxf_get_blocks |
to get a list of block header |
| |
records from a DXF file |
|
dxf_get_table_entries |
to get a list of table entries |
| | from a
DXF file |
|
dx2_get_curves |
to get a list of 2D curves from a |
| | DXF file |
|
dx2_get_points |
to get a list of 2D points from a |
| | DXF
file |
|
dx3_get_curves | to get a list of 3D curves from
a |
| | DXF
file |
|
dx3_get_points |
to get a list of 3D points from a |
| | DXF file |
------------------------------------------------------------------------------
The
following functions explode inserts:
______________________________________________________________________________
|
Function | Use |
|----------------------------------------------------------------------------|
|
dxf_explode |
to explode an insert |
|
dxf_explode_entities | to transform an entity by an |
| | insert
transform, creating all |
| |
elements of an arrayed insert |
|
dxf_explode_entity |
to transform an entity by an |
| | insert
transform, creating the |
| |
specified element of an arrayed |
| |
entity |
------------------------------------------------------------------------------
The
following functions convert items in DXF format to internal format.
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dx2_entity_to_curve |
to convert an entity into a 2D |
| | curve |
|
dx2_entity_to_point |
to convert an entity into a 2D |
| |
point |
|
dx3_entity_to_curve | to convert an entity into a 3D |
| |
curve |
|
dx3_entity_to_point |
to convert an entity into a 3D |
| |
point |
------------------------------------------------------------------------------
Creating
DXF Objects
--------------------
The
following functions create entities:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_create_arc |
to create an ARC entity |
|
dxf_create_attdef |
to create an ATTDEF entity |
|
dxf_create_circle |
to create a CIRCLE entity |
|
dxf_create_descriptor |
to create a DESCRIPTOR entity |
| dxf_create_dimension | to create a DIMENSION
entity |
|
dxf_create_face3d |
to create a FACE3D entity |
|
dxf_create_insert |
to create an INSERT entity |
|
dxf_create_line | to create a LINE
entity |
|
dxf_create_line3d |
to create a LINE3D entity |
|
dxf_create_point |
to create a POINT entity |
|
dxf_create_polyline | to create a POLYLINE entity |
|
dxf_create_shape |
to create a SHAPE entity |
|
dxf_create_solid |
to create a SOLID entity |
|
dxf_create_text |
to create a TEXT entity |
|
dxf_create_trace |
to create a TRACE entity |
|
dxf_insert_add_attrib |
to add an ATTRIB entity to an |
| | INSERT
entity |
|
dxf_polyline_add_vertex |
to add a VERTEX entity to a |
| |
POLYLINE entity |
|
dxf_free_descriptor |
to free a descriptor |
| dxf_free_entity | to free an entity |
------------------------------------------------------------------------------
The
following functions get and set entity properties:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_get_entity_color |
to get the color of an entity |
|
dxf_get_entity_elevation |
to get the elevation of an entity |
|
dxf_get_entity_extrusion |
to get the extrusion of an entity |
|
dxf_get_entity_handle |
to get the handle of an entity |
|
dxf_get_entity_layer |
to get the layer of an entity |
|
dxf_get_entity_ltype |
to get the ltype name of an entity |
|
dxf_get_entity_thickness |
to get the thickness of an entity |
|
dxf_set_entity_color |
to set the color of an entity |
|
dxf_set_entity_elevation |
to set the elevation of an entity |
|
dxf_set_entity_extrusion |
to set the extrusion direction of |
| | an entity |
|
dxf_set_entity_handle |
to set the handle of an entity |
|
dxf_set_entity_layer |
to set the layer of an entity |
|
dxf_set_entity_ltype |
to set the name of an entity |
|
dxf_set_entity_thickness |
to set the thickness of an entity |
------------------------------------------------------------------------------
The
following functions create table entries:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_create_view | to create a VIEW table
entry |
|
dxf_create_vport |
to create a VPORT table entry |
|
dxf_create_ucs |
to create a UCS table entry |
|
dxf_create_ltype | to create a LTYPE table entry |
|
dxf_create_layer |
to create a LAYER table entry |
|
dxf_free_table_entry |
to free a table entry |
------------------------------------------------------------------------------
Output
------
The
following groups of functions are used for writing data to a DXF file.
When
writing data to DXF files using the one-at-a- time and open-file modes,
it is
important to write it in the proper
order. This order is:
*
HEADER
*
TABLES
*
BLOCKS
*
ENTITIES
Each
section must be opened, written and closed in this order. Once
a
section
has been opened, it is not possible to open sections that precede
it. Also, when a section is opened, any previous
section that is open is
closed.
Also,
before a table or a block can be written to, it must be opened.
Opening
a table or block closes any open table or block.
All of
the open, output and close functions return a status value that
signals
that an error occurred. It is
recommended that the return value be
checked
at each step of output.
The
following functions open and close sections for writing:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_open_header |
to open the HEADER section for |
| | writing |
|
dxf_close_header |
to close the HEADER section |
|
dxf_open_tables |
to open the TABLES section for |
| | writing |
|
dxf_open_table |
to open a table for writing |
|
dxf_close_table |
to close a table for writing |
|
dxf_close_tables |
to close the TABLES section for |
| |
writing |
|
dxf_open_blocks |
to open the BLOCKS section for |
| |
writing |
|
dxf_open_block |
to open a block for writing |
|
dxf_close_block |
to close a block for writing |
|
dxf_close_blocks |
to close the BLOCKS section for |
| |
writing |
|
dxf_open_entities |
to open the ENTITIES section for |
| |
writing |
|
dxf_close_entities |
to close the ENTITIES section for |
| |
writing |
------------------------------------------------------------------------------
The
following functions convert internal format to DXF format:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dx2_curve_to_entity |
to convert a 2D curve into an |
| |
entity |
|
dx2_point_to_entity |
to convert a 2D point into an |
| |
entity |
|
dx3_curve_to_entity |
to convert a 3D curve into an |
| |
entity |
| dx3_point_to_entity | to convert a 3D point into
an |
| |
entity |
------------------------------------------------------------------------------
The
following functions write a list of objects to a DXF file using the
one-shot
mode:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_write_entities |
to write a list of entities to a |
| | DXF
file |
|
dx2_write_curves |
to write a list of 2D curves to a |
| | DXF
file |
|
dx2_write_points |
to write a list of 2D points to a |
| | DXF
file |
|
dx3_write_curves |
to write a list of 3D curves to a |
| | DXF
file |
|
dx3_write_points |
to write a list of 3D points to a |
| | DXF
file |
------------------------------------------------------------------------------
The
following functions write objects to a DXF file using the one-at-a-time
mode:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_put_entity |
to write an entity to a DXF file |
|
dxf_put_table_entry |
to write a table entry to a DXF |
| |
file |
|
dxf_put_hdr_var | to put a header variable into
the |
| |
header |
|
dxf_put_comment |
to write a comment to a DXF file |
|
dx2_put_curve |
to write a 2D curve to a DXF file |
|
dx2_put_point |
to write a 2D point to a DXF file |
|
dx3_put_curve |
to write a 3D curve to a DXF file |
|
dx3_put_point |
to write a 3D point to a DXF file |
------------------------------------------------------------------------------
The
following functions write a list of objects to a DXF file using the
open-file
mode:
______________________________________________________________________________
|
Function |
Use |
|----------------------------------------------------------------------------|
|
dxf_put_entities |
to write a list of entities to a |
| | DXF
file |
|
dxf_put_table_entries |
to write a list of table entries |
| | to a
DXF file |
|
dx2_put_curves |
to write a list of 2D curves to a |
| | DXF
file |
|
dx2_put_points |
to write a list of 2D points to a |
| | DXF file |
|
dx3_put_curves |
to write a list of 3D curves to a |
| | DXF
file |
|
dx3_put_points |
to write a list of 3D points to a |
| | DXF
file |
------------------------------------------------------------------------------
Note: The DXF format for a polyline does not
provide a means for recording
spline
curve parametrization type (uniform, non- uniform, etc.) and other
spline
attributes. The CCDK/DXF input functions assume that polylines that
represent
splines are based on the untrimmed
uniform coalesced option.
Therefore
a spline based on any other type of
parametrization, when stored
in a
DXF file and read back, will appear
slightly altered. To preserve the
exact shape of a spline, store it as an insert of
a block consisting of a
polyline
of which the vertices are the original through points, and
attribute
definition entities that record the parametrization type, trimming
parameters,
and start and end tangents.
Alphabetized
Reference
======================
@NEWPAGE
=
***>>
dx2_curve_to_entity <<***
******
Summary ******
#include
<dx2defs.h>
DXF_ENTITY
dx2_curve_to_entity ( file, curve );
******
Description ******
This
function converts a 2D curve into an entity.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | pointer to a DXF file;
may |
| | | be NULL |
------------------------------------------------------------------------------
|
C2_CURVE | curve | a curve |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is an entity constructed from the input curve. If memory
could
not be allocated to create the entity, NULL is returned.
******
Example ******
#include
<dmldefs.h>
#include
<dx2defs.h>
void
curves_to_entities ( curvelist, entitylist )
DML_LIST
curvelist ;
DML_LIST
entitylist ;
{
DML_ITEM item;
C2_CURVE curve;
DXF_ENTITY entity;
DML_WALK_LIST ( curvelist, item )
{
curve = dml_record ( item );
entity = dx2_curve_to_entity ( NULL,
curve );
dml_append_data ( entitylist, entity
);
}
}
This
program builds a list of entities from a list of 2D curves.
***>>
dx2_entity_to_curve <<***
******
Summary ******
#include
<dx2defs.h>
C2_CURVE
dx2_entity_to_curve ( entity );
******
Description ******
This
function converts a curve entity into a 2D curve.
******
Input ******
------------------------------------------------------------------------------
|
DXF_ENTITY | entity | an entity |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is a curve constructed from the input entity. If memory
could
not be allocated to create the curve, or if the entity was not a curve
entity
, NULL is returned.
******
Example ******
#include
<dmldefs.h>
#include
<dx2defs.h>
void
entities_to_curves ( entitylist, curvelist )
DML_LIST
entitylist, curvelist;
{
DML_ITEM item;
DXF_ENTITY entity;
C2_CURVE curve;
DML_WALK_LIST ( entitylist, item )
{
entity = dml_record ( item );
if ( DXF_ENTITY_IS_CURVE(entity) )
{
curve = dx2_entity_to_curve (
entity );
dml_append_data ( curvelist,
curve );
}
}
}
This
program builds a list of 2D curves from a list of entities.
***>>
dx2_entity_to_point <<***
******
Summary ******
#include
<dx2defs.h>
PT2*
dx2_entity_to_point ( entity );
******
Description ******
This
function converts a POINT entity into a 2D point.
******
Input ******
------------------------------------------------------------------------------
|
DXF_ENTITY | entity | an entity |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is a pointer to a point constructed from the input entity.
If
memory could not be allocated to create the point, or if the entity was
not a
POINT entity, NULL is returned.
******
Example ******
#include
<dmldefs.h>
#include
<dx2defs.h>
void
entities_to_points ( entitylist, pointlist )
DML_LIST
entitylist, pointlist;
{
DML_ITEM item;
DXF_ENTITY entity;
PT2 *point;
DML_WALK_LIST ( entitylist, item )
{
entity = dml_record ( item );
if ( DXF_ENTITY_IS_POINT(entity) )
{
point = dx2_entity_to_point (
entity );
dml_append_data ( pointlist,
point );
}
}
}
This
program builds a list of 2D points from a list of entities.
***>>
dx2_get_curve <<***
******
Summary ******
#include
<dx2defs.h>
C2_CURVE
dx2_get_curve ( file, filter );
******
Description ******
This
function creates a 2D curve from a curve entity in a DXF file. The DXF
file
must be positioned at an entity when this function is called. It
selects
the first curve entity qualified by the filter at or after the
current
entity, if any.
After
this function returns, the DXF file is positioned at the next entity,
if any.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; this file should |
| | | have been opened
with |
| | | dxf_fopen |
------------------------------------------------------------------------------
|
DXF_FILTER | filter | a filter; specifies layer, |
| | | color and type of
entities |
| | | to be accepted; if all |
| | | entities should be
accepted, |
| | | this parameter
should be |
| | | NULL; see
dxf_create_filter |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is a 2D curve created from the first curve entity qualified
by the
filter, starting at the current entity. If there are no qualified
entities,
NULL is returned.
******
Example ******
#include
<dxfdefs.h>
#include
<dx2defs.h>
#include
<c2cdefs.h>
#include
<c2ddefs.h>
void
main ( void )
{
DXF_FILTER filter = dxf_create_filter (
DXF_ALL_TYPES,
NULL, DXF_ANY_COLOR );
C2_CURVE curve;
DXF_FILE file = dxf_fopen (
"DATA.DXF", DXF_READ );
if ( file == NULL )
return;
dxf_set_filepos ( file, NULL,
DXF_FIRST_ENTITY );
for ( curve = dx2_get_curve ( file, filter
);
curve != NULL;
curve = dx2_get_curve ( file, filter
) )
{
c2c_info_curve ( curve, NULL );
c2d_free_curve ( curve );
}
dxf_fclose ( file );
dxf_free_filter ( filter );
}
This
program prints information on the screen about each curve entity in the
ENTITIES
section of a DXF file.
***>>
dx2_get_curves <<***
******
Summary ******
#include
<dx2defs.h>
DML_LIST
dx2_get_curves ( file, blockname, filter,
curveslist );
******
Description ******
This
function builds a list of 2D curves from curve entities in a DXF file.
If a
block name is specified, only that block is searched. If the block name
is
NULL, the ENTITIES section is searched. Only
entities qualified by the
filter
are appended to the list.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; should have
been |
| | | opened with
dxf_fopen |
------------------------------------------------------------------------------
|
STRING | blockname | the name of the block to |
| | | search; if this
parameter is |
| | | NULL, the ENTITIES section |
| | | is searched |
------------------------------------------------------------------------------
|
DXF_FILTER | filter | a filter; specifies layer, |
| | | color and type of
entities |
| | | to be accepted; if all |
| | | entities should be
accepted, |
| | | this parameter should be
|
| | | NULL; see
dxf_create_filter |
------------------------------------------------------------------------------
|
DML_LIST | curveslist | a list to which entities are |
| | | appended; may be NULL,
in |
| | | which case a new list is |
| | | created |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is the list to which the input entities were appended. If
the
argument curveslist was NULL, and no
entities were found, NULL is
returned.
If no
entities were found, the status attribute of the DXF file pointer is
set to
DXF_NO_OBJECTS_FOUND. This attribute may be
accessed by the function
dxf_file_status.
******
Example ******
#include
<dxfdefs.h>
#include
<dx2defs.h>
#include
<dmldefs.h>
#include
<c2cdefs.h>
#include
<c2ddefs.h>
void
main ( void )
{
DXF_FILTER filter = dxf_create_filter (
DXF_ALL_TYPES,
NULL, DXF_ANY_COLOR );
C2_CURVE curve;
DML_LIST list;
DML_ITEM item;
DXF_FILE file = dxf_fopen (
"DATA.DXF", DXF_READ );
if ( file == NULL )
return;
list = dx2_get_curves ( file, NULL,
filter, NULL );
DML_WALK_LIST ( list, item )
{
curve = dml_record ( item );
c2c_info_curve ( curve, NULL );
}
dml_destroy_list ( list, ( PF_VOID )
c2d_free_curve );
dxf_fclose ( file );
dxf_free_filter ( filter );
}
This
program builds a list of 2D curves from curve entities in the ENTITIES
section
of the file DATA.DXF and prints information
about each curve on the
screen.
It then destroys the list.
***>>
dx2_get_point <<***
******
Summary ******
#include
<dx2defs.h>
PT2*
dx2_get_point ( file, filter );
******
Description ******
This
function creates a 2D point from a POINT entity in a DXF file. The DXF
file
must be positioned at an entity when this function is called. It
selects
the first POINT entity qualified by the filter
at or after the
current
entity, if any.
After
this function returns, the DXF file is positioned at the next entity,
if any.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; this file
should |
| | | have been opened
with |
| | | dxf_fopen |
------------------------------------------------------------------------------
|
DXF_FILTER | filter | a filter; specifies layer,
|
| | | color and type of
entities |
| | | to be accepted; if all |
| | | entities should be
accepted, |
| | | this parameter
should be |
| | | NULL; see
dxf_create_filter |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is a 2D point created from the first POINT entity qualified
by the
filter, starting at the current entity. If
there are no qualified
entities,
NULL is returned.
******
Example ******
#include
<dxfdefs.h>
#include
<dx2defs.h>
#include
<c2ddefs.h>
void
main ( void )
{
DXF_FILTER filter = dxf_create_filter (
DXF_ALL_TYPES,
NULL, DXF_ANY_COLOR );
PT2 *p;
DXF_FILE file = dxf_fopen (
"DATA.DXF", DXF_READ );
if ( file == NULL )
return;
dxf_set_filepos ( file, NULL,
DXF_FIRST_ENTITY );
for ( p = dx2_get_point ( file, filter );
p != NULL;
p = dx2_get_point ( file, filter ) )
{
printf ( "%lf %lf\n",
PT2_X(*p), PT2_Y(*p) );
c2d_free_point ( p );
}
dxf_fclose ( file );
dxf_free_filter ( filter );
}
This
program converts each POINT entity in the ENTITIES section of DATA.DXF
into a
point, prints the x and y coordinates,
and frees the created point.
***>>
dx2_get_points <<***
******
Summary ******
#include
<dx2defs.h>
DML_LIST
dx2_get_points ( file, blockname, filter,
pointslist );
******
Description ******
This
function builds a list of 2D points from POINT entities in a DXF file.
If a
block name is specified, only that block is
searched. If the block name
is
NULL, the ENTITIES section is searched.
Only point entities qualified by
the
filter are used.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; should have been |
| | | opened for reading
with |
| | | dxf_fopen |
------------------------------------------------------------------------------
|
STRING | blockname | the block name to search; if |
| | | this parameter is NULL,
the |
| | | ENTITIES section is
searched |
------------------------------------------------------------------------------
|
DXF_FILTER | filter | a filter; specifies layer, |
| | | color and type of
entities |
| | | to be accepted; if all |
| | | entities should be
accepted, |
| | | this parameter
should be |
| | | NULL; see
dxf_create_filter |
------------------------------------------------------------------------------
|
DML_LIST | pointslist | a list to which entities are |
| |
| appended; may be NULL, in |
| | | which case a new list is |
| | | created |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is the list to which the input entities were appended. If
the
argument pointslist was NULL, and no
entities were found, NULL is
returned.
If no
entities were found, the status attribute of the DXF file pointer is
set to
DXF_NO_OBJECTS_FOUND. This attribute may be
accessed by the function
dxf_file_status.
******
Example ******
#include
<dxfdefs.h>
#include
<dx2defs.h>
#include
<dmldefs.h>
#include
<c2ddefs.h>
void
main ( void )
{
DXF_FILTER filter = dxf_create_filter (
DXF_ALL_TYPES,
NULL, DXF_ANY_COLOR );
PT2 *p;
DML_LIST list;
DML_ITEM item;
DXF_FILE file = dxf_fopen (
"DATA.DXF", DXF_READ );
if ( file == NULL )
return;
list = dx2_get_points ( file, NULL,
filter, NULL );
DML_WALK_LIST ( list, item )
{
p = dml_record ( item );
printf ( "%lf %lf\n",
PT2_X(*p), PT2_Y(*p) );
}
dml_destroy_list ( list, ( PF_VOID )
c2d_free_point );
dxf_fclose ( file );
dxf_free_filter ( filter );
}
This
program builds a list of 2D points from POINT entities in the ENTITIES
section
of DATA.DXF, prints the x and y
coordinates, and destroys the list.
***>>
dx2_point_to_entity <<***
******
Summary ******
#include
<dx2defs.h>
DXF_ENTITY
dx2_point_to_entity ( file, pt );
******
Description ******
This
function converts a 2D point to a POINT entity.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | pointer to a DXF file;
may |
| | | be NULL |
------------------------------------------------------------------------------
|
PT2 | pt | a point |
------------------------------------------------------------------------------
******
Return Value ******
The
return value is an entity constructed from the input point. If memory
could
not be allocated to create the entity, NULL is returned.
******
Example ******
#include
<dmldefs.h>
#include
<dx2defs.h>
void
points_to_entities ( pointlist, entitylist )
DML_LIST
pointlist, entitylist;
{
DML_ITEM item;
PT2 *point;
DXF_ENTITY entity;
DML_WALK_LIST ( pointlist, item )
{
point = dml_record ( item );
entity = dx2_point_to_entity ( NULL,
*point );
dml_append_data ( entitylist, entity
);
}
}
This
program builds a list of POINT entities from a list of 2D points.
***>>
dx2_put_curve <<***
******
Summary ******
#include
<dx2defs.h>
BOOLEAN
dx2_put_curve ( file, curve, descriptor );
******
Description ******
This
function writes a 2D curve to a DXF file.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; should have
been |
| | | opened for writing
with |
| | |
dxf_fopen |
------------------------------------------------------------------------------
|
C2_CURVE | curve | the curve to be written |
------------------------------------------------------------------------------
|
DXF_ENTITY_DESC | descriptor | a descriptor; specifies |
| | | layer, color, line pattern, |
| | | elevation, thickness
and |
| | | extrusion direction;
see |
| | |
dxf_create_descriptor |
------------------------------------------------------------------------------
******
Return Value ******
This
function returns TRUE if the curve was written successfully, or FALSE
if an
error occured.
******
Example ******
#include
<dxfdefs.h>
#include
<dx2defs.h>
void
put_curve ( file, curve, layer, ltype_name, color )
DXF_FILE
file ;
C2_CURVE
curve ;
STRING
layer, ltype_name ;
INT
color ;
{
DXF_ENTITY_DESC descriptor =
dxf_create_descriptor ( layer,
ltype_name, color, 0.0, NULL )
;
if ( !dx2_put_curve ( file, curve,
descriptor ) )
printf ( "Error writing
curve\n" );
dxf_free_descriptor ( descriptor );
}
This
program writes a curve to the ENTITIES section of a DXF file.
***>>
dx2_put_curves <<***
******
Summary ******
#include
<dx2defs.h>
BOOLEAN
dx2_put_curves ( file, curves, descriptor );
******
Description ******
This
function writes a list of 2D curves to a DXF file. The curves must be
of type
C2_CURVE.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; should have
been |
| | | opened for writing
with |
| | | dxf_open |
------------------------------------------------------------------------------
|
DML_LIST | curves | list of curves to be
written |
------------------------------------------------------------------------------
|
DXF_ENTITY_DESC | descriptor | a descriptor; specifies |
| | | layer, color, line pattern, |
| | | elevation, thickness
and |
| | | extrusion direction; see
|
| | |
dxf_create_descriptor |
------------------------------------------------------------------------------
******
Return Value ******
This
function returns TRUE if all of the curves were written successfully,
or
FALSE if an error occured.
******
Example ******
#include
<dxfdefs.h>
#include
<dx2defs.h>
void
put_curves ( file, curves, layer, ltype_name, color )
DXF_FILE
file ;
DML_LIST
curves ;
STRING
layer, ltype_name ;
INT
color ;
{
DXF_ENTITY_DESC descriptor =
dxf_create_descriptor ( layer,
ltype_name, color, 0.0, NULL )
;
if ( !dx2_put_curves ( file, curves,
descriptor ) )
printf ( "Error writing
curves\n" );
dxf_free_descriptor ( descriptor );
}
This
program writes a list of 2D curves to a DXF file.
***>>
dx2_put_point <<***
******
Summary ******
#include
<dx2defs.h>
BOOLEAN
dx2_put_point ( file, point, descriptor );
******
Description ******
This
function writes a 2D point to a DXF file.
******
Input ******
------------------------------------------------------------------------------
|
DXF_FILE | file | a DXF file; should have
been |
| | | opened for writing with |
| | | dxf_fopen |
------------------------------------------------------------------------------
|
PT2 | point | the point to be written |
------------------------------------------------------------------------------
|
DXF_ENTITY_DESC | descriptor | a descriptor; specifies |
| | | layer, color, line pattern, |
| | | elevation, thickness
and |
| | | extrusion direction;
see |
| | |
dxf_create_descriptor |
------------------------------------------------------------------------------
******
Return Value ******
This function returns TRUE if the point was successfully writte