DXF reader def

Top  Previous  Next

 

 

CAD/CAM Developer's Kit/3D

 

Reference Guide

 

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 written, or  FALSE

if an error occurred.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx2defs.h>

 

void put_point ( file, point, layer, ltype_name, color )

DXF_FILE file ;

PT2 point ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

                ltype_name, color, 0.0, NULL ) ;

    if ( !dx2_put_point ( file, point, descriptor ) )

          printf ( "Error writing point\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a 2D point to a DXF file.

 

***>> dx2_put_points <<***

 

****** Summary ******

 

#include <dx2defs.h>

 

BOOLEAN dx2_put_points ( file, points, descriptor );

 

****** Description ******

 

This function writes a list of points to a DXF file. The points must  be of

type PT2.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| DML_LIST               | points             | list of points 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 list was written successfully, or  FALSE if

an error occurred.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx2defs.h>

 

void put_points ( file, points, layer, ltype_name, color )

DXF_FILE file ;

DML_LIST points ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

                ltype_name, color, 0.0, NULL ) ;

    if ( !dx2_put_points ( file, points, descriptor ) )

          printf ( "Error writing points\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of 2D points to a DXF file.

 

***>> dx2_read_curves <<***

 

****** Summary ******

 

#include <dx2defs.h>

 

DML_LIST dx2_read_curves ( filename, blockname,  filter, curveslist );

 

****** Description ******

 

This function builds a list of 2D curves from curve entities in a DXF  file.

It reads curve entities from a specified block name and  qualified by a given

filter, if specified. If the block name is NULL,  it reads the entities from

the ENTITIES section. It opens the  file, reads the entities, creates the

curves, and closes the file.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file             |

------------------------------------------------------------------------------

| 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               | 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 );

    DML_LIST list = dx2_read_curves ( "DATA.DXF", NULL, filter, NULL );

    DML_ITEM item;

    C2_CURVE curve;

 

    if ( list != NULL )

    {

          DML_WALK_LIST ( list, item )

          {

                curve = ( C2_CURVE ) dml_record ( item );

                c2c_info_curve ( curve, NULL );

          }

 

          dml_destroy_list ( list, ( PF_VOID ) c2d_free_curve );

    }

 

    dxf_free_filter ( filter );

}

This program builds a list of 2D curves from curve entities in  the ENTITIES

section of DATA.DXF. It prints information about  each curve on the list to

the screen and then destroys the list.

 

***>> dx2_read_points <<***

 

****** Summary ******

 

#include <dx2defs.h>

 

DML_LIST dx2_read_points ( filename, blockname,  filter, pointslist );

 

****** Description ******

 

This function builds a list of 2D points from POINT entities in a DXF  file.

It reads point entities from a specified block which are  qualified by a

given filter, if specified. If the block name is NULL,  it reads entities

from the ENTITIES section. It opens the file, reads  the entities, creates

the points, and closes the file.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file             |

------------------------------------------------------------------------------

| 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 );

    DML_LIST list = dx2_read_points ( "DATA.DXF", NULL, filter, NULL );

    DML_ITEM item;

    PT2 *p;

 

    if ( list != NULL )

    {

          DML_WALK_LIST ( list, item )

          {

                p = ( PT2 * ) dml_record ( item );

                printf ( "%lf %lf\n", PT2_X(*p), PT2_Y(*p) );

          }

 

          dml_destroy_list ( list, ( PF_VOID ) c2d_free_point );

    }

 

    dxf_free_filter ( filter );

}

This program builds a list of 2D points from POINT  entities in the ENTITIES

section of DATA.DXF. It prints the  x and y coordinates of each point on the

list to the  screen and then destroys the list.

 

***>> dx2_write_curve <<***

 

****** Summary ******

 

#include <dx2defs.h>

 

BOOLEAN dx2_write_curve ( filename, file_type, curve,  descriptor )

 

****** Description ******

 

This function creates a DXF file, and writes a curve to it.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | DXF file name                |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | file_type          | file type; DXF_ACSII or      |

|                        |                    | DXF_BINARY                   |

------------------------------------------------------------------------------

| C2_CURVE               | curve              | a curve                      |

------------------------------------------------------------------------------

| DXF_ENTITY_DESC        | descriptor         | a DXF descriptor             |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is TRUE if the DXF file was created, and the curve  was

successfully written. It is FALSE otherwise.

 

****** Example ******

 

************

 

***>> dx2_write_curves <<***

 

****** Summary ******

 

#include <dx2defs.h>

 

BOOLEAN dx2_write_curves ( filename, file_type,  curves, descriptor );

 

****** Description ******

 

This function writes the curves on a list to a DXF file, with  properties

specified by the given descriptor. The curves must be of  type C2_CURVE. This

function opens the file for writing,  writes the curves, and closes the file.

 

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file to write to  |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | file_type          | DXF_ASCII or DXF__BINARY     |

------------------------------------------------------------------------------

| 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 the curves were written succesfully, or  FALSE

if an error occurred.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx2defs.h>

 

void write_curves ( curves, layer, ltype_name, color )

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_write_curves ( "DATA.DXF",

          DXF_ASCII, curves, descriptor ) )

          printf ( "Error writing curves\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of curves to DATA.DXF.

 

***>> dx2_write_points <<***

 

****** Summary ******

 

#include <dx2defs.h>

 

BOOLEAN dx2_write_points ( filename, file_type,  points, descriptor );

 

****** Description ******

 

This function writes the points on a list to a DXF file, with  properties

specified by the given descriptor. The points must be of  type PT2. This

function opens the file for writing, writes  the points, and closes the file.

 

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file to write to  |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | file_type          | DXF_ASCII or DXF_BINARY      |

------------------------------------------------------------------------------

| DML_LIST               | points             | list of points 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 points were written succesfully, or  FALSE

if an error occurred.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx2defs.h>

 

void write_points ( points, layer, ltype_name, color )

DML_LIST points ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

          ltype_name, color, 0.0, NULL ) ;

    if ( !dx2_write_points ( "DATA.DXF",

          DXF_ASCII, points, descriptor ) )

          printf ( "Error writing points\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of 2D points to DATA.DXF.

 

***>> dx3_curve_to_entity <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

DXF_ENTITY dx3_curve_to_entity ( file, curve );

 

****** Description ******

 

This function converts a 3D curve to an entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| C3_CURVE               | curve              | a curve                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is an entity that is constructed from the input  curve. If

memory could not be allocated to create the entity, NULL is  returned.

 

****** Example ******

 

#include <dmldefs.h>

#include <dx3defs.h>

 

void curves_to_entities ( curvelist, entitylist )

DML_LIST curvelist ;

DML_LIST entitylist ;

{

    DML_ITEM item;

    C3_CURVE curve;

    DXF_ENTITY entity;

 

    DML_WALK_LIST ( curvelist, item )

    {

          curve = dml_record ( item );

          entity = dx3_curve_to_entity ( NULL, curve );

          dml_append_data ( entitylist, entity );

    }

}

This program builds a list of entities from a list of 3D curves.

 

***>> dx3_entity_to_curve <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

C3_CURVE dx3_entity_to_curve ( entity );

 

****** Description ******

 

This function converts a curve entity to a 3D curve.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a 3D curve that is constructed from the input  entity. If

memory could not be allocated to create the curve, or if  the entity was not

a curve, NULL is returned.

 

****** Example ******

 

#include <dmldefs.h>

#include <dx3defs.h>

 

void entities_to_curves ( entitylist, curvelist )

 

DML_LIST entitylist, curvelist;

{

    DML_ITEM item;

    DXF_ENTITY entity;

    C3_CURVE curve;

 

    DML_WALK_LIST ( entitylist, item )

    {

          entity = dml_record ( item );

          if ( DXF_ENTITY_IS_CURVE(entity) )

          {

                curve = dx3_entity_to_curve ( entity );

                dml_append_data ( curvelist, curve );

          }

    }

}

This program builds a list of 3D curves from the  curve entities in  a list

of entities.

 

***>> dx3_entity_to_point <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

PT3* dx3_entity_to_point ( entity );

 

****** Description ******

 

This function converts a POINT entity to a 3D point.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a 3D point that is constructed from the input  entity. If

memory could not be allocated to create the point, NULL is  returned.

 

****** Example ******

 

#include <dmldefs.h>

#include <dx3defs.h>

 

void entities_to_points ( entitylist, pointlist )

 

DML_LIST entitylist, pointlist;

{

    DML_ITEM item;

    DXF_ENTITY entity;

    PT3 *point;

 

    DML_WALK_LIST ( entitylist, item )

    {

          entity = dml_record ( item );

          if ( DXF_ENTITY_IS_POINT(entity) )

          {

                point = dx3_entity_to_point ( entity );

                dml_append_data ( pointlist, point );

          }

    }

}

This program builds a list of 3D points from the POINT entities  in a list of

entities.

 

***>> dx3_get_curve <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

C3_CURVE dx3_get_curve ( file, filter );

 

****** Description ******

 

This function reads a 3D curve from a curve entity in a DXF file. The  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 postioned at the next  entity,

if any.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; this file should  |

|                        |                    | have been opened for reading  |

|                        |                    |  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 curve created from the first curve entity  qualified by

the filter, starting at the current entity. If there  were no qualified

entities, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.h>

#include <c3cdefs.h>

#include <c3ddefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    C3_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 = dx3_get_curve ( file, filter );

          curve != NULL;

          curve = dx3_get_curve ( file, filter ) )

    {

          c3c_info_curve ( curve, NULL );

          c3d_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.

 

***>> dx3_get_curves <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

DML_LIST dx3_get_curves ( file, blockname, filter,  curveslist );

 

****** Description ******

 

This function builds a list of 3D 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 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               | 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 <dx3defs.h>

#include <dmldefs.h>

#include <c3cdefs.h>

#include <c3ddefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    C3_CURVE curve;

    DML_LIST list;

    DML_ITEM item;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    list = dx3_get_curves ( file, NULL, filter, NULL );

 

    DML_WALK_LIST ( list, item )

    {

          curve = dml_record ( item );

          c3c_info_curve ( curve, NULL );

    }

 

    dml_destroy_list ( list, ( PF_VOID ) c3d_free_curve );

 

    dxf_fclose ( file );

    dxf_free_filter ( filter );

}

This program builds a list of 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.

 

***>> dx3_get_point <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

PT3* dx3_get_point ( file, filter );

 

****** Description ******

 

This function creates a 3D point from a POINT entity in a DXF  file. The 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 for reading  |

|                        |                    |  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 3D 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 <dx3defs.h>

#include <c3ddefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    PT3 *p;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    dxf_set_filepos ( file, NULL, DXF_FIRST_ENTITY );

 

    for ( p = dx3_get_point ( file, filter );

          p != NULL;

          p = dx3_get_point ( file, filter ) )

    {

          printf ( "%lf %lf %lf\n", PT3_X(*p), PT3_Y(*p), PT3_Z(*p) );

          c3d_free_point ( p );

    }

 

    dxf_fclose ( file );

    dxf_free_filter ( filter );

}

This program reads each POINT entity in the ENTITIES  section of DATA.DXF,

converts it into a point, prints the x,  y and z coordinates, and frees the

created point.

 

***>> dx3_get_points <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

DML_LIST dx3_get_points ( file, blockname, filter,  pointslist );

 

****** Description ******

 

This function builds a list of 3D 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 entities qualified by the

filter are used.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_open                     |

------------------------------------------------------------------------------

| 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 <dx3defs.h>

#include <dmldefs.h>

#include <c3ddefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    PT3 *p;

    DML_LIST list;

    DML_ITEM item;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    list = dx3_get_points ( file, NULL, filter, NULL );

 

    DML_WALK_LIST ( list, item )

    {

          p = dml_record ( item );

          printf ( "%lf %lf %lf\n", PT3_X(*p), PT3_Y(*p), PT3_Z(*p) );

    }

 

    dml_destroy_list ( list, ( PF_VOID ) c3d_free_point );

 

    dxf_fclose ( file );

    dxf_free_filter ( filter );

}

This program builds a list of 3D points from POINT entities in  the ENTITIES

section of DATA.DXF, prints the x,  y, and z coordinates of each point, and

destroys the  created point.

 

***>> dx3_point_to_entity <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

DXF_ENTITY dx3_point_to_entity ( file, pt );

 

****** Description ******

 

This function converts a 3D point to a POINT entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| PT3                    | pt                 | a point                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is an entity that is constructed from the input  point. If

memory could not be allocated to create the entity, NULL is  returned.

 

****** Example ******

 

#include <dmldefs.h>

#include <dx3defs.h>

 

void points_to_entities ( pointlist, entitylist )

 

DML_LIST pointlist, entitylist;

{

    DML_ITEM item;

    PT3 *point;

    DXF_ENTITY entity;

 

    DML_WALK_LIST ( pointlist, item )

    {

          point = dml_record ( item );

          entity = dx3_point_to_entity ( NULL, *point );

          dml_append_data ( entitylist, entity );

    }

}

This program builds a list of POINT entities from a list of 3D  points.

 

***>> dx3_put_curve <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_put_curve ( file, curve, descriptor );

 

****** Description ******

 

This function writes a 3D curve to a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| C3_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 is written successfully, or  FALSE if

an error occured.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.h>

 

void put_curve ( file, curve, layer, ltype_name, color )

DXF_FILE file ;

C3_CURVE curve ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

                ltype_name, color, 0.0, NULL ) ;

    if ( !dx3_put_curve ( file, curve, descriptor ) )

          printf ( "Error writing curve\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a 3D curve to the ENTITIES section of a DXF  file.

 

***>> dx3_put_curves <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_put_curves ( file, curves, descriptor );

 

****** Description ******

 

This function writes a list of 3D curves to a DXF file. All objects  on the

list must be of type C3_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.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.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 ( !dx3_put_curves ( file, curves, descriptor ) )

          printf ( "Error writing curves\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of 3D curves to a DXF file.

 

***>> dx3_put_point <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_put_point ( file, point, descriptor );

 

****** Description ******

 

This function writes a 3D point to a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| PT3                    | 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 is successfully written, or  FALSE if

an error occurred.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.h>

 

void put_point ( file, point, layer, ltype_name, color )

DXF_FILE file ;

PT3 point ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

                ltype_name, color, 0.0, NULL ) ;

    if ( !dx3_put_point ( file, point, descriptor ) )

          printf ( "Error writing point\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a 3D point to a DXF file.

 

***>> dx3_put_points <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_put_points ( file, points, descriptor );

 

****** Description ******

 

This function writes a list of 3D points to a DXF file. All objects  on the

list must be of type PT3.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| DML_LIST               | points             | list of points 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 list was written successfully, or  FALSE if

an error occurred.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.h>

 

void put_points ( file, points, layer, ltype_name, color )

DXF_FILE file ;

DML_LIST points ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

                ltype_name, color, 0.0, NULL ) ;

    if ( !dx3_put_points ( file, points, descriptor ) )

          printf ( "Error writing points\n" );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of 3D points to a DXF file.

 

***>> dx3_read_curves <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

DML_LIST dx3_read_curves ( filename, blockname,  filter, curveslist );

 

****** Description ******

 

This function builds a list of 3D curves from curve entities in a DXF  file.

It reads entities from a given block and qualified by a given  filter, if

specified. If blockname is NULL, it reads entities  from the ENTITIES

section. It opens the file, reads the  entities, creates the curves, and

closes the file.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file             |

------------------------------------------------------------------------------

| 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               | 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 <dx3defs.h>

#include <dmldefs.h>

#include <c3cdefs.h>

#include <c3ddefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    DML_LIST list = dx3_read_curves ( DATA.DXF, NULL, filter, NULL );

    DML_ITEM item;

    C3_CURVE curve;

 

    if ( list != NULL )

    {

          DML_WALK_LIST ( list, item )

          {

                curve = ( C3_CURVE ) dml_record ( item );

                c3c_info_curve ( curve, NULL );

          }

          dml_destroy_list ( list, ( PF_VOID ) c3d_free_curve );

    }

 

    dxf_free_filter ( filter );

}

This program builds a list of 3D curves from curve entities in the  ENTITIES

section of DATA.DXF. It prints information to the  screen about each curve on

the list, then destroys the list.

 

***>> dx3_read_points <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

DML_LIST dx3_read_points ( filename, blockname,  filter, pointslist );

 

****** Description ******

 

This function builds a list of 3D points from POINT entities in  a DXF file.

It accepts POINT entities from a given block name  and qualified by a given

filter, if specified. If the block name is  NULL, it reads the ENTITIES

section. This function opens the file,  reads the entities, and closes the

file.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file             |

------------------------------------------------------------------------------

| 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 <dx3defs.h>

#include <dmldefs.h>

#include <c3ddefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    DML_LIST list = dx3_read_points ( DATA.DXF,

          NULL, filter, NULL );

    DML_ITEM item;

    PT3 *p;

 

    if ( list != NULL )

    {

          DML_WALK_LIST ( list, item )

          {

                p = ( PT3 * ) dml_record ( item );

                printf ( %lf %lf %lf\n, PT3_X(*p), PT3_Y(*p), PT3_Z(*p) );

          }

 

          dml_destroy_list ( list, ( PF_VOID ) c3d_free_point );

    }

 

    dxf_free_filter ( filter );

}

This program builds a list of 3D points from POINT entities in  the ENTITIES

section of DATA.DXF. It prints to the  screen the x, y, and z coordinates of

each  point on the list, then destroys the list.

 

***>> dx3_write_curve <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_write_curve ( filename, file_type, curve,  descriptor )

 

****** Description ******

 

This function creates a DXF file and writes a curve to it.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | DXF file name                |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | file_type          | file type; DXF_ASCII or      |

|                        |                    | DXF_BINARY                   |

------------------------------------------------------------------------------

| C3_CURVE               | curve              | a curve                      |

------------------------------------------------------------------------------

| DXF_ENTITY_DESC        | descriptor         | a DXF descriptor             |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is TRUE if the DXF file was created, and the curve  was

successfully written. It is FALSE otherwise.

 

****** Example ******

 

************

 

***>> dx3_write_curves <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_write_curves ( filename, file_type,  curves, descriptor );

 

****** Description ******

 

This function writes a list of 3D curves to a DXF file, with  properties

specified by the given descriptor. All objects on the  list must be of type

C3_CURVE. This function opens the file  for writing, writes the curves, and

closes the file.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file to write to  |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | file_type          | DXF_ASCII or DXF_BINARY      |

------------------------------------------------------------------------------

| 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 the curves were written successfully, or  FALSE

if an error occurred.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.h>

 

void write_curves ( curves, layer, ltype_name, color )

DML_LIST curves ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

          ltype_name, color, 0.0, NULL ) ;

    if ( !dx3_write_curves ( DATA.DXF,

          DXF_ASCII, curves, descriptor ) )

          printf ( Error writing curves\n );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of curves to DATA.DXF.

 

***>> dx3_write_points <<***

 

****** Summary ******

 

#include <dx3defs.h>

 

BOOLEAN dx3_write_points ( filename, file_type,  points, descriptor );

 

****** Description ******

 

This function writes a list of 3D points to a DXF file, with  properties

specified by the given descriptor. All objects on the  list must be of type

PT3. This function opens the file for  writing, writes the points, and closes

the file.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file to write to  |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | file_type          | DXF_ASCII or DXF_BINARY      |

------------------------------------------------------------------------------

| DML_LIST               | points             | list of points 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 points were written successfully, or  FALSE

if an error occurred.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

#include <dx3defs.h>

 

void write_points ( points, layer, ltype_name, color )

DML_LIST points ;

STRING layer, ltype_name ;

INT color ;

{

    DXF_ENTITY_DESC descriptor = dxf_create_descriptor ( layer,

          ltype_name, color, 0.0, NULL ) ;

    if ( !dx3_write_points ( DATA.DXF,

          DXF_ASCII, points, descriptor ) )

          printf ( Error writing points\n );

    dxf_free_descriptor ( descriptor );

}

This program writes a list of points to DATA.DXF.

 

***>> dxf_block_base_pt <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_block_base_pt ( file, blockname, base_pt );

 

****** Description ******

 

This function reads the base point of a given block in a DXF file.  The DXF

file position after this function returns is the position at  the time when

this function was called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; this file should  |

|                        |                    | have been opened for reading  |

|                        |                    |  with dxf_fopen              |

------------------------------------------------------------------------------

| STRING                 | blockname          | name of block; to select the  |

|                        |                    | current block, this          |

|                        |                    | parameter  should be NULL    |

------------------------------------------------------------------------------

 

****** Output ******

 

------------------------------------------------------------------------------

| REAL                   | base_pt[3]         | x, y, and z coordinates of   |

|                        |                    | the base  point of the       |

|                        |                    | selected block; user must    |

|                        |                    | supply an array of 3 REALs   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if a non-existent block was specified,  or if

NULL was specified and the DXF file was not positioned at a  block.

Otherwise, it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

 

BOOLEAN get_base_point ( base_pt )

REAL base_pt[3] ;

{

    char block_name[32] ;

    BOOLEAN status ;

    DXF_FILE file = dxf_fopen ( DATA.DXF, DXF_READ ) ;

 

    if ( file == NULL ) {

          printf ( No such file\n ) ;

          RETURN ( FALSE ) ;

    }

    printf ( Enter block name\n ) ;

    scanf ( %s, block_name ) ;

 

    status = dxf_block_base_pt ( file,

          block_name, base_pt ) ;

    if ( !status )

          printf ( Block %s not found\n, block_name );

    RETURN ( status ) ;

}

This program gets a specified block base point.

 

***>> dxf_close_block <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_close_block ( file );

 

****** Description ******

 

This function closes a block that had been open for writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if there is no open block, or if the  BLOCKS

section of the DXF file has already been closed.  Otherwise it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void entities_to_block ( file, entities )

DXF_FILE file ;

DML_LIST entities ;

{

    char name[32], layer[32] ;

    REAL base_pt[3] ;

 

    printf ( Enter the block name\n ) ;

    scanf ( %s, name ) ;

    printf ( Enter the block layer\n ) ;

    scanf ( %s, layer ) ;

    printf ( Enter the base point of the block\n ) ;

    scanf ( %lf%lf%lf, base_pt, base_pt+1, base_pt+2 ) ;

    dxf_open_block ( file, name, layer, 0, base_pt ) ;

    if ( !dxf_put_entities ( file, entities ) )

          printf ( Error writing entities\n ) ;

    dxf_close_block ( file ) ;

}

This program opens a block in a DXF file, writes a list of entities  to the

block, and closes it.

 

***>> dxf_close_blocks <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_close_blocks ( file );

 

****** Description ******

 

This function closes the BLOCKS section for writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if the BLOCKS section was not open.  Otherwise,

it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_block ( file, entities )

DXF_FILE file ;

DML_LIST entities ;

{

    char name[32], layer[32] ;

    REAL base_pt[3] ;

    if ( !dxf_open_blocks ( file ) )

          printf ( Could not open BLOCKS section\n ) ;

    printf ( Enter the block name\n ) ;

    scanf ( %s, name ) ;

    printf ( Enter the block layer\n ) ;

    scanf ( %s, layer ) ;

    printf ( Enter the base point of the block\n ) ;

    scanf ( %lf%lf%lf, base_pt, base_pt+1, base_pt+2 ) ;

    dxf_open_block ( file, name, layer, 0, base_pt ) ;

    if ( !dxf_put_entities ( file, entities ) )

          printf ( Error writing entities\n ) ;

    dxf_close_block ( file ) ;

    dxf_close_blocks ( file ) ;

}

This program opens the BLOCKS section of a DXF file, opens a  block, writes a

list of entities to the block, and closes the block  and the BLOCKS section.

 

***>> dxf_close_entities <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_close_entities ( file );

 

****** Description ******

 

This function closes the ENTITIES section in a DXF file for  writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if the ENTITIES section was not open.  Otherwise,

it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_entities ( file, entities )

DXF_FILE file ;

DML_LIST entities ;

{

    if ( !dxf_open_entities ( file ) )

          printf ( Could not open ENTITIES section\n ) ;

    if ( !dxf_put_entities ( file, entities ) )

          printf ( Error writing entities\n ) ;

    dxf_close_entities ( file ) ;

}

This program opens the ENTITIES section of a DXF file, writes a  list of

entities to it, and closes the section.

 

***>> dxf_close_header <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_close_header ( file );

 

****** Description ******

 

This function closes the HEADER section of a DXF file for  writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if the HEADER section was not open.  Otherwise,

it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_header ( file )

DXF_FILE file ;

{

    INT data = 0;

    if ( !dxf_open_header ( file ) ) {

          printf ( Cannot open the HEADER section\n ) ;

          return;

    }

    dxf_put_hdr_var ( file, $FLATLAND, &data ) ;

    dxf_close_header ( file ) ;

}

This program opens a HEADER section in a DXF file and then  closes it.

 

***>> dxf_close_table <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_close_table ( file );

 

****** Description ******

 

This function closes a table that had been open for writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if there was no open table, or if the  TABLES

section was not open. Otherwise, it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

void put_ltypes ( file, ltypes )

DXF_FILE file ;

DML_LIST ltypes ;

{

    if ( !dxf_open_tables ( file ) ) {

          printf ( Cannot open the TABLES section\n ) ;

          return;

    }

    if ( !dxf_open_table ( file, DXF_LTYPE,

          dml_length(ltypes) ) ) {

          printf ( Cannot open the table\n ) ;

          return;

    }

    if ( !dxf_put_table_entries ( file, ltypes ) )

          printf ( Error writing table entries\n );

    dxf_close_table ( file ) ;

    dxf_close_tables ( file ) ;

}

This function opens the TABLES section of a DXF file, opens the  line type

table, writes a list of line types, and closes the table  and the TABLES

section.

 

***>> dxf_close_tables <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_close_tables ( file );

 

****** Description ******

 

This function closes the TABLES section in a DXF file for writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if the TABLES section was not  open. Otherwise,

it returns TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

void put_tables ( file )

DXF_FILE file ;

{

    if ( !dxf_open_tables ( file ) ) {

          printf ( Cannot open the TABLES section\n ) ;

          return;

    }

    dxf_close_tables ( file ) ;

}

This program opens the TABLES section of a DXF file and then  closes it.

 

***>> dxf_create_3dface <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_3dface ( file, pt0, pt1, pt2,  pt3, flags );

 

****** Description ******

 

This function creates a 3DFACE entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | <%-5>pt0[3],       | x, y, z coordinates of the   |

|                        | pt1[3], pt2[3],    | vertices of the face         |

|                        | pt3[3]<%0>         |                              |

------------------------------------------------------------------------------

| INT                    | flags              | flags                        |

------------------------------------------------------------------------------

 

Valid options for 3DFACE 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   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_face3d_entity ( void )

{

    REAL pt0[3], pt1[3], pt2[3], pt3[3] ;

    INT flags ;

    DXF_ENTITY face3d_entity ;

    char response ;

 

    printf ( Enter x and y coordinates of the first vertex\n ) ;

    scanf ( %lf%lf, pt0, pt0+1 ) ;

    pt0[2] = 0.0 ;

    printf ( Enter x and y coordinates of the second vertex\n ) ;

    scanf ( %lf%lf, pt1, pt1+1 ) ;

    pt1[2] = 0.0 ;

    printf ( Enter x and y coordinates of the third vertex\n ) ;

    scanf ( %lf%lf, pt2, pt2+1 ) ;

    pt2[2] = 0.0 ;

    printf ( Enter x and y coordinates of the fourth vertex\n ) ;

    scanf ( %lf%lf, pt3, pt3+1 ) ;

    pt3[2] = 0.0 ;

    flags = 0 ;

    printf ( Is the first edge invisible?\n ) ;

    scanf ( %c, &response ) ;

    if ( response == 'y' )

          flags |= DXF_FACE3D_E1_INVIS ;

    printf ( Is the second edge invisible?\n ) ;

    scanf ( %c, &response ) ;

    if ( response == 'y' )

          flags |= DXF_FACE3D_E2_INVIS ;

    printf ( Is the third edge invisible?\n ) ;

    scanf ( %c, &response ) ;

    if ( response == 'y' )

          flags |= DXF_FACE3D_E3_INVIS ;

    printf ( Is the fourth edge invisible?\n ) ;

    scanf ( %c, &response ) ;

    if ( response == 'y' )

          flags |= DXF_FACE3D_E4_INVIS ;

                face3d_entity = dxf_create_3dface ( NULL, pt0, pt1,

                pt2, pt3, flags ) ;

    RETURN ( face3d_entity ) ;

}

This program creates a FACE3D entity with specified properties.

 

***>> dxf_create_appid <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_appid ( file, name )

 

****** Description ******

 

This function creates a DXF application ID table entry.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| STRING                 | name               | application ID name          |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is an application ID table entry. It is NULL if the  table

entry object could not be created.

 

****** Example ******

 

*******************************

 

***>> dxf_create_arc <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_arc ( file, ctr, rad, angle0, angle1 );

 

****** Description ******

 

This function creates an ARC entity, given its center, radius,  start angle,

and end angle. The z-coordinate of the center is  the elevation of the arc.

The angular parameters must be given in  degrees.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | ctr[3]             | x, y, z coordinates of       |

|                        |                    | center                       |

------------------------------------------------------------------------------

| REAL                   | rad                | radius of the arc            |

------------------------------------------------------------------------------

| REAL                   | angle0             | start angle of arc           |

------------------------------------------------------------------------------

| REAL                   | angle1             | end angle of arc             |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_arc_entity ( void )

{

    REAL ctr[3], rad, angle0, angle1 ;

    DXF_ENTITY arc_entity ;

 

    printf ( Enter x and y coordinates of the center of the arc\n ) ;

    scanf ( %lf%lf, ctr, ctr+1 ) ;

    ctr[2] = 0.0 ;

    printf ( Enter radius and start and end angles of the arc\n ) ;

    scanf ( %lf%lf%lf, &rad, &angle0, &angle1 ) ;

    arc_entity = dxf_create_arc ( NULL, ctr, rad, angle0, angle1 ) ;

    RETURN ( arc_entity ) ;

}

This program creates an ARC entity with specified properties.

 

***>> dxf_create_attdef <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_attdef ( file, text_pt, height, text,  prompt, tag,

flags, length, angle, scale, style_name );

 

****** Description ******

 

This function creates an ATTDEF entity with the specified  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | text_pt[3]         | x, y, z coordinates of text  |

|                        |                    | insertion point              |

------------------------------------------------------------------------------

| REAL                   | height             | height of characters         |

------------------------------------------------------------------------------

| STRING                 | text               | attribute default value      |

------------------------------------------------------------------------------

| STRING                 | prompt             | prompt string                |

------------------------------------------------------------------------------

| STRING                 | tag                | tag string                   |

------------------------------------------------------------------------------

| INT                    | flags              | attribute flags              |

------------------------------------------------------------------------------

| INT                    | length             | field length                 |

------------------------------------------------------------------------------

| REAL                   | angle              | angle of text                |

------------------------------------------------------------------------------

| REAL                   | scale              | relative x-scale factor      |

------------------------------------------------------------------------------

| STRING                 | style_name         | text style name              |

------------------------------------------------------------------------------

 

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 insert  attributes         |

------------------------------------------------------------------------------

 

These options may be combined with the bitwise-or (|) operator.

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_attdef ( void )

{

    REAL pt[3], height ;

    DXF_ENTITY attdef_entity ;

    char text[32], prompt[32], tag[32], response ;

    INT flags ;

 

    printf ( Enter x and y coordinates  );

    printf ( of the text start point\n ) ;

    scanf ( %lf%lf, pt, pt+1 ) ;

    pt[2] = 0.0 ;

    printf ( Enter height of the text\n ) ;

    scanf ( %lf, &height ) ;

    printf ( Enter the text, prompt, and tag strings\n ) ;

    scanf ( %s%s%s, text, prompt, tag ) ;

    flags = 0 ;

    printf ( Is the attribute invisible?\n ) ;

    scanf ( %c, &response ) ;

    if ( response == 'y' )

          flags |= DXF_ATTDEF_INVIS ;

    attdef_entity = dxf_create_attdef ( NULL, pt, height, text,

          prompt, tag, flags, 0, 0.0, 1.0, NULL ) ;

    RETURN ( attdef_entity ) ;

}

This program creates an ATTDEF entity of specified properties.

 

***>> dxf_create_circle <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_circle ( file, ctr, rad );

 

****** Description ******

 

This function creates a CIRCLE entity, given its center and  radius. The z

coordinate of the center is the elevation of  the circle.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | ctr[3]             | x, y, z coordinates of       |

|                        |                    | center                       |

------------------------------------------------------------------------------

| REAL                   | rad                |  radius                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_circle_entity ( void )

{

    REAL ctr[3], rad ;

    DXF_ENTITY circle_entity ;

 

    printf ( Enter x and y coordinates of the center\n ) ;

    scanf ( %lf%lf, ctr, ctr+1 ) ;

    ctr[2] = 0.0 ;

    printf ( Enter radius of the circle\n ) ;

    scanf ( %lf, &rad ) ;

    circle_entity = dxf_create_circle ( NULL, ctr, rad ) ;

    RETURN ( circle_entity ) ;

}

This program creates a CIRCLE entity with specified properties.

 

***>> dxf_create_descriptor <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY_DESC dxf_create_descriptor ( layer,  ltype_name, color, elevation,

extrusion );

 

****** Description ******

 

This function creates a descriptor for writing curves and points with  the

specified properties. A descriptor must be freed after it is  used.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | layer              | layername to be assigned to  |

|                        |                    | geometry                     |

------------------------------------------------------------------------------

| STRING                 | ltype_name         | line type to be assigned to  |

|                        |                    | geometry                     |

------------------------------------------------------------------------------

| INT                    | color              | color to be assigned to      |

|                        |                    | geometry; permissible values  |

|                        |                    | are  0 - 15                  |

------------------------------------------------------------------------------

| REAL                   | elevation          | elevation of the geometry    |

------------------------------------------------------------------------------

| REAL                   | extrusion[3]       | extrusion direction of the   |

|                        |                    | geometry                     |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a descriptor with the specified properties. If  memory

could not be allocated to create the descriptor, NULL is  returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY_DESC create_descriptor ( void )

{

    char layer[32], ltype_name[32] ;

    DXF_ENTITY_DESC descriptor ;

    INT color ;

    printf ( Enter layer, linetype names and color\n ) ;

    scanf ( %s%s%d, layer, ltype_name, &color ) ;

    descriptor = dxf_create_descriptor ( layer,

          ltype_name, color, 0.0, NULL ) ;

    RETURN ( descriptor ) ;

}

This program creates a descriptor with specified properties.

 

***>> dxf_create_dimension <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_dimension ( file, name, def_pt,  mid_pt, insert_pt,

type, text, def_pt3, def_pt4, def_pt5, def_pt6,  leader_length, angle );

 

****** Description ******

 

This function creates a DIM entity with the specified  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | name               | pseudo-block name of current  |

|                        |                    | dimension picture            |

------------------------------------------------------------------------------

| REAL                   | def_pt[3]          | definition point             |

------------------------------------------------------------------------------

| REAL                   | mid_pt[3]          | middle point                 |

------------------------------------------------------------------------------

| REAL                   | insert_pt[3]       | insertion point for clones   |

|                        |                    | of a dimension               |

------------------------------------------------------------------------------

| INT                    | type               | type                         |

------------------------------------------------------------------------------

| STRING                 | text               | dimension text               |

------------------------------------------------------------------------------

| REAL                   | def_pt3[3]         | definition point for linear  |

|                        |                    | and angular dimensions; may  |

|                        |                    | be  NULL                     |

------------------------------------------------------------------------------

| REAL                   | def_pt4[3]         | definition point for linear  |

|                        |                    | and angular dimensions; may  |

|                        |                    | be  NULL                     |

------------------------------------------------------------------------------

| REAL                   | def_pt5[3]         | definition point for         |

|                        |                    | diameter, radius, and        |

|                        |                    | angular  dimensions; may be  |

|                        |                    | NULL                         |

------------------------------------------------------------------------------

| REAL                   | def_pt6[3]         | definition point for         |

|                        |                    | diameter, radius, and        |

|                        |                    | angular  dimensions; may be  |

|                        |                    | NULL                         |

------------------------------------------------------------------------------

| REAL                   | leader_length      | leader length for radius and  |

|                        |                    | diameter dimensions          |

------------------------------------------------------------------------------

| REAL                   | angle              | angle of rotated,            |

|                        |                    | horizontal, or vertical      |

|                        |                    | linear dimensions            |

------------------------------------------------------------------------------

 

See the AutoCAD(R) Reference Manual for further details.

 

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                              |

|                                      | value is the created entity. If     |

|                                      | memory could not be  allocated to   |

|                                      | create the entity, NULL is          |

|                                      | returned.                           |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_dim ( void )

{

    REAL def_pt[3], mid_pt[3] ;

    DXF_ENTITY dim_entity ;

    char name[32] ;

 

    printf ( "Enter name of pseudo-Block picture\n" ) ;

    scanf ( "%s", name ) ;

    printf ( "Enter x and y coordinates " );

    printf ( "of the definition point\n" ) ;

    scanf ( "%lf%lf", def_pt, def_pt+1 ) ;

    def_pt[2] = 0.0 ;

    printf ( "Enter x and y coordinates " );

    printf ( "of the dim. text\n" ) ;

    scanf ( "%lf%lf", mid_pt, mid_pt+1 ) ;

    mid_pt[2] = 0.0 ;

    dim_entity = dxf_create_dimension ( NULL, name, def_pt, mid_pt,

          NULL, DXF_DIM_STANDARD, NULL, NULL,

                NULL, NULL, NULL, 0.0, 0.0 ) ;

    RETURN ( dim_entity ) ;

}

This program creates a DIM entity with specified properties.

 

***>> dxf_create_dimstyle <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_dimstyle ( file, name,  dimpost, dimapost, dimblk,

dimblk1, dimblk2, scale )

 

****** Description ******

 

This function creates a dimstyle table entry.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| STRING                 | name               | dimstyle name                |

------------------------------------------------------------------------------

| STRING                 | dimpost            | dimpost parameter            |

------------------------------------------------------------------------------

| STRING                 | dimapost           | dimapost parameter           |

------------------------------------------------------------------------------

| STRING                 | dimblk             | dimblk parameter             |

------------------------------------------------------------------------------

| STRING                 | dimblk1            | dimblk1 parameter            |

------------------------------------------------------------------------------

| STRING                 | dimblk2            | dimblk2 parameter            |

------------------------------------------------------------------------------

| REAL                   | scale              | scale                        |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is dimstyle table entry. It is NULL if the table  entry

object could not be created.

 

****** Example ******

 

************

 

***>> dxf_create_filter <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_FILTER dxf_create_filter ( type, layer, color );

 

****** Description ******

 

This function creates a filter for the specified type, layer, and  color.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY_ID          | type               | type of entity to be         |

|                        |                    | accepted by filter, see      |

|                        |                    | above; filter  types may be  |

|                        |                    | combined with the bitwise-or  |

|                        |                    | operator (|)                 |

------------------------------------------------------------------------------

| STRING                 | layer              | layername to be accepted; if  |

|                        |                    | NULL, there is no layer      |

|                        |                    | restriction                  |

------------------------------------------------------------------------------

| INT                    | color              | color to be accepted         |

------------------------------------------------------------------------------

 

Valid options for type are:

 

______________________________________________________________________________

| Type                                 | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_POINT                            | accept POINT entities               |

| DXF_LINE                             | accept LINE entities                |

| DXF_CIRCLE                           | accept CIRCLE entities              |

| DXF_ARC                              | accept ARC entities                 |

| DXF_TRACE                            | accept TRACE entities               |

| DXF_SOLID                            | accept SOLID entities               |

| DXF_POLYLINE                         | accept POLYLINE entities            |

| DXF_LINE3D                           | accept LINE3D entities              |

| DXF_FACE3D                           | accept FACE3D entities              |

| DXF_TEXT                             | accept TEXT entities                |

| DXF_SHAPE                            | accept SHAPE entities               |

| DXF_INSERT                           | accept INSERT entities              |

| DXF_ATTDEF                           | accept ATTDEF entities              |

| DXF_ATTRIB                           | accept ATTRIB entities              |

| DXF_DIM                              | accept DIM entities                 |

| DXF_ALL_TYPES                        | accept any type of entity           |

| DXF_CURVE                            | accept LINE, CIRCLE, ARC, TRACE,    |

|                                      | SOLID, POLYLINE, LINE3D  or FACE3D  |

|                                      | entities                            |

------------------------------------------------------------------------------

 

Possible values for color are:

 

______________________________________________________________________________

| Value                                | Meaning                             |

|----------------------------------------------------------------------------|

| 0-15                                 | accept specified color              |

| DXF_ANY_COLOR                        | accept any color                    |

|                                      | value is a filter of the specified  |

|                                      | type, layer and color. If memory    |

|                                      | could not be allocated to create    |

|                                      | the filter, NULL is  returned.      |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

#include <dmldefs.h>

 

void read_entities ( file, outlist )

DXF_FILE file ;

DML_LIST outlist ;

{

    DXF_FILTER filter;

    DML_LIST list;

 

    filter = dxf_create_filter ( DXF_CURVE, "1",

          DXF_ANY_COLOR );

 

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

 

    dxf_filter_set_layer ( filter, "2" );

    dxf_filter_add_type ( filter, DXF_INSERT | DXF_POINT );

    dxf_filter_set_color ( filter, 15 );

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

 

    dxf_free_filter ( filter );

}

This program creates a filter, gets qualified entities from the  ENTITIES

section of a DXF file, and appends them to a list. It  then changes the

filter and repeats the process.

 

***>> dxf_create_insert <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_insert ( file, block_name, insert_pt,  scale, angle,

cols_count, rows_count, col_spacing, row_spacing );

 

****** Description ******

 

This function creates an INSERT entity with the specified properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | block_name         | block name that the insert   |

|                        |                    | is to be made from           |

------------------------------------------------------------------------------

| REAL                   | insert_pt[3]       | x, y, z coordinates of       |

|                        |                    | insert point                 |

------------------------------------------------------------------------------

| REAL                   | scale              | scale of insert              |

------------------------------------------------------------------------------

| REAL                   | angle              | insert angle                 |

------------------------------------------------------------------------------

| INT                    | cols_count         | number of columns of an      |

|                        |                    | arrayed insert; if the       |

|                        |                    | insert will  not be arrayed,  |

|                        |                    | this parameter should be 1   |

------------------------------------------------------------------------------

| INT                    | rows_count         | number of rows of an arrayed  |

|                        |                    | insert; if the insert will   |

|                        |                    | not  be arrayed, this        |

|                        |                    | parameter should be 1        |

------------------------------------------------------------------------------

| REAL                   | col_spacing        | column spacing of an arrayed  |

|                        |                    | insert with columns; if the   |

|                        |                    | insert will not have         |

|                        |                    | columns, this parameter      |

|                        |                    | should be 0                  |

------------------------------------------------------------------------------

| REAL                   | row_spacing        | row spacing of an arrayed    |

|                        |                    | insert with rows; if the     |

|                        |                    | insert  will not have rows,  |

|                        |                    | this parameter should be 0   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is an INSERT entity with the specified  properties. If

memory could not be allocated to create the entity,  NULL is returned.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_insert ( void )

{

    REAL insert_pt[3] ;

    DXF_ENTITY insert_entity ;

    char block_name[32] ;

 

    printf ( "Enter the block name\n" ) ;

    scanf ( "%s", block_name ) ;

    printf ( "Enter x and y coordinates of the insert point\n" ) ;

    scanf ( "%lf%lf", insert_pt, insert_pt+1 ) ;

    insert_pt[2] = 0.0 ;

    insert_entity = dxf_create_insert ( NULL, block_name,

          insert_pt, 1.0, 0.0, 1, 1, 0.0, 0.0 ) ;

    RETURN ( insert_entity ) ;

}

This program creates an INSERT entity with specified  properties.

 

***>> dxf_create_layer <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_layer ( file,  name, color,  frozen, ltypename );

 

****** Description ******

 

This function creates a LAYER table entry with the specified  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | name               | name of the layer            |

------------------------------------------------------------------------------

| INT                    | color              | color, 0 - 15                |

------------------------------------------------------------------------------

| BOOLEAN                | frozen             | TRUE specifies that the      |

|                        |                    | layer is frozen; otherwise   |

|                        |                    | FALSE                        |

------------------------------------------------------------------------------

| STRING                 | ltypename          | name of default line type;   |

|                        |                    | if NULL, it is set to        |

|                        |                    | "STANDARD"                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a LAYER table entry with the specified  properties. If

memory could not be allocated to create the table  entry, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY create_layer ( void )

{

    DXF_TABLE_ENTRY layer ;

    char name[32], ltype_name[32], response ;

    INT color ;

 

    printf ( "Enter the layer and linetype names\n" ) ;

    scanf ( "%s%s", name, ltype_name ) ;

    printf ( "Enter the color\n" ) ;

    scanf ( "%d", &color ) ;

    printf ( "Is this layer frozen?\n" ) ;

    scanf ( "%c", &response ) ;

    layer = dxf_create_layer ( NULL, name, color,

          (response=='y'), ltype_name ) ;

    RETURN ( layer ) ;

}

This program creates a LAYER table entry with specified  properties.

 

***>> dxf_create_line <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_line ( file, pt0, pt1 );

 

****** Description ******

 

This function creates a LINE entity defined by given start and  end points.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | pt0[3]             | x, y, z coordinates of start  |

|                        |                    | point                        |

------------------------------------------------------------------------------

| REAL                   | pt1[3]             | x, y, z coordinates of end   |

|                        |                    | point                        |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity.  If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_line_entity ( void )

{

    REAL pt0[3], pt1[3] ;

    DXF_ENTITY line_entity ;

 

    printf ( "Enter x and y coordinates of the first point\n" ) ;

    scanf ( "%lf%lf", pt0, pt0+1 ) ;

    pt0[2] = 0.0 ;

    printf ( "Enter x and y coordinates of the second point\n" ) ;

    scanf ( "%lf%lf", pt1, pt1+1 ) ;

    pt1[2] = 0.0 ;

    line_entity = dxf_create_line ( NULL, pt0, pt1 ) ;

    RETURN ( line_entity ) ;

}

This program creates a LINE entity with specified endpoints.

 

***>> dxf_create_line3d <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_line3d ( file, pt0, pt1 );

 

****** Description ******

 

This function creates a LINE3D entity defined by given start and  end points.

 

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | pt0[3]             | x, y, z coordinates of start  |

|                        |                    | point                        |

------------------------------------------------------------------------------

| REAL                   | pt1[3]             | x, y, z coordinates of end   |

|                        |                    | point                        |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_line3d_entity ( void )

{

    REAL pt0[3], pt1[3] ;

    DXF_ENTITY line3d_entity ;

 

    printf ( "Enter coordinates of the first point\n" ) ;

    scanf ( "%lf%lf%lf", pt0, pt0+1, pt0+2 ) ;

    printf ( "Enter coordinates of the second point\n" ) ;

    scanf ( "%lf%lf%lf", pt1, pt1+1, pt1+2 ) ;

    line3d_entity = dxf_create_line3d ( NULL, pt0, pt1 ) ;

    RETURN ( line3d_entity ) ;

}

This program creates a LINE3D entity with specified endpoints.

 

***>> dxf_create_ltype <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_ltype ( file, name, text,  algnt_code,

total_length, count, length );

 

****** Description  ******

 

This function creates an LTYPE table entry with the specified  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | name               | name of line type            |

------------------------------------------------------------------------------

| STRING                 | text               | descriptinve text for line   |

|                        |                    | type                         |

------------------------------------------------------------------------------

| INT                    | algnt_code         | alignment code of line type  |

------------------------------------------------------------------------------

| INT                    | count              | number of dashes in pattern  |

------------------------------------------------------------------------------

| REAL                   | total_length       | total pattern length         |

------------------------------------------------------------------------------

| REAL                   | *length            | array of dash lengths; there  |

|                        |                    | are count elements in  this  |

|                        |                    | array                        |

------------------------------------------------------------------------------

 

See AutoCAD(R) Reference Manual for further information.

 

****** Return Value ******

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY create_ltype ( void )

{

    DXF_TABLE_ENTRY ltype ;

    char name[32], text[128] ;

    INT i, code, n ;

    REAL total_length, *length ;

 

    printf ( "Enter the linetype name " );

    printf ( "and its descriptive text\n" ) ;

    scanf ( "%s%s", name, text ) ;

    printf ( "Enter the alignment code\n" ) ;

    scanf ( "%d", &code ) ;

    printf ( "Enter the number of dash length items\n" ) ;

    scanf ( "%d", &n ) ;

    printf ( "Enter the total pattern length\n" ) ;

    scanf ( "%lf", &total_length ) ;

    if ( n == 0 )

          length = NULL ;

    else {

          length = malloc ( n * sizeof(REAL) ) ;

          for ( i=0 ; i<n ; i++ ) {

                printf ( "Enter the dash length %d\n", i+1 ) ;

                scanf ( "%lf", length+i ) ;

          }

    }

    ltype = dxf_create_ltype ( NULL, name, text, code,

          total_length, n, length ) ;

    if ( n>0 )

          free ( length ) ;

    RETURN ( ltype ) ;

}

This program creates an LTYPE table entry with the specified  properties.

 

***>> dxf_create_point <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_point ( file, pt );

 

****** Description ******

 

This function creates a POINT entity with specified  coordinates.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | pt[3]              | x, y, z coordinates of point  |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_point_entity ( void )

{

    REAL pt[3] ;

    DXF_ENTITY point_entity ;

 

    printf ( "Enter coordinates of the point\n" ) ;

    scanf ( "%lf%lf%lf", pt, pt+1, pt+2 ) ;

    point_entity = dxf_create_point ( NULL, pt ) ;

    RETURN ( point_entity ) ;

}

This program creates a POINT entity with specified coordinates.

 

***>> dxf_create_polyline <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_polyline ( file, flags, type );

 

****** Description ******

 

This function creates a POLYLINE entity with the specified flags  and type.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| INT                    | flags              | flags                        |

------------------------------------------------------------------------------

| INT                    | type               | mesh type                    |

------------------------------------------------------------------------------

 

Valid options for polyline flags include:

 

______________________________________________________________________________

| Option                               | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_PLINE_CLSD                       | polyline is closed                  |

| DXF_PLINE_CURVE_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                |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_polyline ( points )

DML_LIST points ;

{

    INT flags, type ;

    DXF_ENTITY polyline ;

    DML_ITEM item ;

    char response ;

    REAL *point ;

 

    flags = 0 ;

    printf ( "Will the polyline be closed\n" ) ;

    scanf ( "%c", &response ) ;

    if ( response == 'y' )

          flags = DXF_PLINE_CLSD ;

    printf ( "Is it a cubic(c) or quadratic(q) " );

    printf ( "spline or a polygon?\n" ) ;

    scanf ( "%c", &response ) ;

    if ( response == 'c' )

          type = DXF_PLINE_CUBIC ;

    else if ( response == 'q' )

          type = DXF_PLINE_QUADR ;

    else

          type = DXF_PLINE_NSMOOTH ;

    polyline = dxf_create_polyline ( NULL, flags, type ) ;

 

    DML_WALK_LIST ( points, item ) {

          point = (REAL*)DML_RECORD(item) ;

          dxf_polyline_add_vertex ( NULL, polyline, point, 0.0, 0 ) ;

    }

    RETURN ( polyline ) ;

}

This program creates a POLYLINE entity with specified  properties.

 

***>> dxf_create_shape <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_shape ( file, insert_pt, size, name,  angle, scale );

 

****** Description ******

 

This function creates a SHAPE entity with the specified  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | insert_pt[3]       | insertion point of the shape  |

------------------------------------------------------------------------------

| REAL                   | size               | shape height                 |

------------------------------------------------------------------------------

| STRING                 | name               | shape name                   |

------------------------------------------------------------------------------

| REAL                   | angle              | angle of orientation of the  |

|                        |                    | shape                        |

------------------------------------------------------------------------------

| REAL                   | scale              | relative x-scale factor      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

DXF_ENTITY create_shape ( void )

{

    REAL pt[3], size ;

    char name[32] ;

    DXF_ENTITY shape ;

    printf ( "Enter x and y coordinates " );

    printf ( "of the insert point of the shape\n" ) ;

    scanf ( "%lf%lf", pt, pt+1 ) ;

    pt[2] = 0.0 ;

    printf ( "Enter size of the shape\n" ) ;

    scanf ( "%lf", &size ) ;

    printf ( "Enter name of the shape\n" ) ;

    scanf ( "%s", name ) ;

    shape = dxf_create_shape ( NULL, pt, size, name, 0.0, 1.0 ) ;

    RETURN ( shape ) ;

}

This program creates a SHAPE entity with specified properties.

 

***>> dxf_create_solid <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_solid ( file, pt0, pt1, pt2, pt3 );

 

****** Description ******

 

This function creates a SOLID entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | <%-5>pt0[3],       | x, y, z coordinates of the   |

|                        | pt1[3], pt2[3],    | vertices of the solid        |

|                        | pt3[3]<%0>         |                              |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_solid_entity ( void )

{

    REAL pt0[3], pt1[3], pt2[3] ;

    DXF_ENTITY solid_entity ;

 

    printf ( "Enter x and y coordinates of the first " );

    printf ( "point of the solid\n" ) ;

    scanf ( "%lf%lf", pt0, pt0+1 ) ;

    pt0[2] = 0.0 ;

    printf ( "Enter x and y coordinates of the second " );

    printf ( "point of the solid\n" ) ;

    scanf ( "%lf%lf", pt1, pt1+1 ) ;

    pt1[2] = 0.0 ;

    printf ( "Enter x and y coordinates of the third " );

    printf ( "point of the solid\n" ) ;

    scanf ( "%lf%lf", pt2, pt2+1 ) ;

    pt2[2] = 0.0 ;

    solid_entity = dxf_create_solid ( NULL, pt0, pt1, pt2, NULL ) ;

    RETURN ( solid_entity ) ;

}

This program creates a SOLID entity, given three specified  points and one

zero-length edge.

 

***>> dxf_create_text <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_text ( file, insert_pt, height, text,  angle, scale,

style_name );

 

****** Description ******

 

This function creates a TEXT entity with the specified  properties and text.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | insert_pt[3]       | insert point of the text     |

------------------------------------------------------------------------------

| REAL                   | height             | character height             |

------------------------------------------------------------------------------

| STRING                 | text               | the text itself              |

------------------------------------------------------------------------------

| REAL                   | angle              | angle of text                |

------------------------------------------------------------------------------

| REAL                   | scale              | relative x-scale factor      |

------------------------------------------------------------------------------

| STRING                 | style_name         | text style                   |

------------------------------------------------------------------------------

 

Valid options for text flags include:

 

______________________________________________________________________________

| Flag 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 are adjusted             |

| DXF_TEXT_MID_CNTRD                   | text is centered both vertically    |

|                                      | and horizontally about a  point     |

| DXF_TEXT_FIT                         | text is fit between two points;     |

|                                      | only width is adjusted              |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

@NEWPAGE =

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_text ( void )

{

    REAL pt[3], height ;

    DXF_ENTITY text_entity ;

    char text_value[128] ;

 

    printf ( "Enter x and y coordinates of the " );

    printf ( "insert point of the text\n" ) ;

    scanf ( "%lf%lf", pt, pt+1 ) ;

    pt[2] = 0.0 ;

    printf ( "Enter height of the text\n" ) ;

    scanf ( "%lf", &height ) ;

    printf ( "Enter the text\n" ) ;

    scanf ( "%s%s%s", text_value ) ;

    text_entity = dxf_create_text ( NULL, pt, height,

          text_value, 0.0, 1.0, NULL ) ;

    RETURN ( text_entity ) ;

}

This program creates a TEXT entity with specified properties  and text.

 

***>> dxf_create_trace <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_trace ( file, pt0, pt1, pt2, pt3 );

 

****** Description ******

 

This function creates a TRACE entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| REAL                   | <%-5>pt0[3],       | x, y, z coordinates of the   |

|                        | pt1[3], pt2[3],    | vertices of the trace        |

|                        | pt3[3]<%0>         |                              |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created entity. If memory could not be  allocated to

create the entity, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_trace_entity ( void )

{

    REAL pt0[3], pt1[3], pt2[3], pt3[3] ;

    DXF_ENTITY trace_entity ;

    pt0[2] = pt1[2] = pt2[2] = pt3[2] = 0.0 ;

    printf ( "Enter x and y coordinates of the " );

    printf ( "first point of the trace\n" ) ;

    scanf ( "%lf%lf", pt0, pt0+1 ) ;

    printf ( "Enter x and y coordinates of the " );

    printf ( "second point of the trace\n" ) ;

    scanf ( "%lf%lf", pt1, pt1+1 ) ;

    printf ( "Enter x and y coordinates of the " );

    printf ( "third point of the trace\n" ) ;

    scanf ( "%lf%lf", pt2, pt2+1 ) ;

    printf ( "Enter x and y coordinates of the " );

    printf ( "fourth point of the trace\n" ) ;

    scanf ( "%lf%lf", pt3, pt3+1 ) ;

    trace_entity = dxf_create_trace ( NULL, pt0, pt1, pt2, pt3 ) ;

    RETURN ( trace_entity ) ;

}

This program creates a TRACE entity with specified points.

 

***>> dxf_create_ucs <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_ucs ( file, name, origin, x_axis,  y_axis );

 

****** Description ******

 

This function creates a user coordinate system, given a 3D origin  point, a

3D x-axis and an orthogonal 3D-y axis. The z-axis is  orthogonal to the plane

formed by the given axes.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | name               | name of the coordinate       |

|                        |                    | system                       |

------------------------------------------------------------------------------

| REAL                   | origin[3]          | x, y, z coordinates of       |

|                        |                    | origin                       |

------------------------------------------------------------------------------

| REAL                   | x_axis[3]          | vector defining the x-axis   |

------------------------------------------------------------------------------

| REAL                   | y_axis[3]          | vector defining the y-axis;  |

|                        |                    | must be orthogonal to the    |

|                        |                    | x-axis                       |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created table entry. If memory could not be

allocated to create the table entry, or if the axes are not  orthogonal, NULL

is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY create_ucs ( void )

{

    DXF_TABLE_ENTRY ucs ;

    REAL origin[3], x_axis[3], y_axis[3] ;

 

    printf ( "Enter the origin\n" ) ;

    scanf ( "%lf%lf%lf", origin, origin+1, origin+2 ) ;

    printf ( "Enter the x-axis\n" ) ;

    scanf ( "%lf%lf%lf", x_axis, x_axis+1, x_axis+2 ) ;

    printf ( "Enter the y-axis\n" ) ;

    scanf ( "%lf%lf%lf", y_axis, y_axis+1, y_axis+2 ) ;

    ucs = dxf_create_ucs ( NULL, NULL, origin, x_axis, y_axis ) ;

    RETURN ( ucs ) ;

}

This program creates a UCS table entry with specified  properties.

 

***>> dxf_create_view <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_view ( file, name, h, w, ctr,  direction,

target_pt );

 

****** Description ******

 

This function creates a VIEW table entry with the given  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | name               | view name                    |

------------------------------------------------------------------------------

| REAL                   | h                  | view height                  |

------------------------------------------------------------------------------

| REAL                   | w                  | view width                   |

------------------------------------------------------------------------------

| REAL                   | ctr[3]             | x, y, z coordinates of view  |

|                        |                    | center point                 |

------------------------------------------------------------------------------

| REAL                   | direction[3]       | x, y, z coordinates of view  |

|                        |                    | direction vector             |

------------------------------------------------------------------------------

| REAL                   | target_pt[3]       | x, y, z coordinates of view  |

|                        |                    | target point                 |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created table entry. If the table entry could  not be

created, or if memory could not be allocated to create the  table entry, NULL

is returned.

 

****** Example ******

 

#include <dxfdefs.h>

DXF_TABLE_ENTRY create_view ( void )

{

    DXF_TABLE_ENTRY view ;

    REAL h, w, ctr[2], direction[3], target_pt[3] ;

    printf ( "Enter the view center point\n" ) ;

    scanf ( "%lf%lf", ctr, ctr+1 ) ;

    printf ( "Enter view direction from target\n" ) ;

    scanf ( "%lf%lf%lf", direction, direction+1, direction+2 ) ;

    printf ( "Enter the target_pt\n" ) ;

    scanf ( "%lf%lf%lf", target_pt, target_pt+1, target_pt+2 ) ;

    printf ( "Enter the height and width\n" ) ;

    scanf ( "%lf%lf", &h, &w ) ;

    view = dxf_create_view ( NULL, NULL, h, w, ctr,

          direction, target_pt ) ;

    RETURN ( view ) ; }

This program creates a VIEW table entry with specified  properties.

 

***>> dxf_create_viewport <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_create_viewport ( file, ctr_pt[3],  width, height, id, status,

target_pt[3], dir_vec[3] )

 

****** Description ******

 

This function creates a viewport entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| REAL                   | ctr_pt[3]          | center point                 |

------------------------------------------------------------------------------

| REAL                   | width              | width                        |

------------------------------------------------------------------------------

| REAL                   | height             | height                       |

------------------------------------------------------------------------------

| INT                    | id                 | id                           |

------------------------------------------------------------------------------

| INT                    | status             | status                       |

------------------------------------------------------------------------------

| REAL                   | target_pt[3]       | target point                 |

------------------------------------------------------------------------------

| REAL                   | dir_vec[3]         | direction vector             |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a viewport entity.  It is NULL if the entity  could not

be created.

 

****** Example ******

 

************

 

***>> dxf_create_vport <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_create_vport ( file, name, x0, y0, x1,  y1, ctr,

direction, target_pt, height, aspect_ratio );

 

****** Description ******

 

This function creates a VPORT table entry with the given  properties.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| STRING                 | name               | viewport name                |

------------------------------------------------------------------------------

| REAL                   | x0, y0             | screen coordinates of lower  |

|                        |                    | left corner of viewport;     |

|                        |                    | lower left  corner of screen  |

|                        |                    | is 0,0, upper right corner   |

|                        |                    | of screen is 1,1             |

------------------------------------------------------------------------------

| REAL                   | x1, y1             | screen coordinates of upper  |

|                        |                    | right corner of viewport     |

------------------------------------------------------------------------------

| REAL                   | ctr[2]             | x, y coordinates of viewport  |

|                        |                    | center point                 |

------------------------------------------------------------------------------

| REAL                   | direction[3]       | x, y, z coordinates of       |

|                        |                    | viewport direction vector    |

------------------------------------------------------------------------------

| REAL                   | target_pt[3]       | x, y, z coordinates of       |

|                        |                    | viewport target point        |

------------------------------------------------------------------------------

| REAL                   | height             | viewport height              |

------------------------------------------------------------------------------

| REAL                   | aspect_ratio       | viewport aspect ratio        |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the created table entry. If the table entry could  not be

created, or if memory could not be allocated to create the  table entry, NULL

is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY create_vport ( void )

{

    DXF_TABLE_ENTRY vport ;

    REAL x0, y0, x1, y1, height, ar,

          ctr[2], direction[3], target_pt[3] ;

 

    printf ( "Enter the lower left corner of viewport\n" ) ;

    scanf ( "%lf%lf", &x0, &y0 ) ;

    printf ( "Enter the upper right corner of viewport\n" ) ;

    scanf ( "%lf%lf", &x1, &y1 ) ;

    printf ( "Enter the view center point\n" ) ;

    scanf ( "%lf%lf", ctr, ctr+1 ) ;

    printf ( "Enter view direction from target point\n" ) ;

    scanf ( "%lf%lf%lf", direction, direction+1, direction+2 ) ;

    printf ( "Enter the view target_pt\n" ) ;

    scanf ( "%lf%lf%lf", target_pt, target_pt+1, target_pt+2 ) ;

    printf ( "Enter height and aspect ratio\n" ) ;

    scanf ( "%lf%lf", &height, &ar ) ;

    vport = dxf_create_vport ( NULL, NULL, x0, y0, x1, y1, ctr,

          direction, target_pt, height, ar ) ;

    RETURN ( vport ) ;

}

This program creates a VPORT table entry with specified  properties.

 

***>> dxf_explode <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DML_LIST dxf_explode ( file, insert, filter,  entitylist, );

 

****** Description ******

 

This function explodes INSERT entities into their component entities. It

returns a list of the component entities qualified by the filter.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for reading with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| DXF_ENTITY             | insert             | the insert to be exploded    |

------------------------------------------------------------------------------

| 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               | entitylist         | 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 entitylist 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 <dmldefs.h>

#include <dxfdefs.h>

void append_entities ( insert, file, outlist )

DXF_ENTITY insert;

DXF_FILE file;

DML_LIST outlist;

{

    DML_LIST list = dml_create_list();

    list = dxf_explode ( file, insert, NULL, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

}

This program explodes an insert and appends the resulting list of  entities

to an existing list.

 

***>> dxf_explode_entities <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_explode_entities ( file, entity, base_pt,  insert, entitylist );

 

****** Description ******

 

This function rotates, translates and scales an entity. Translation  is

determined by the base point and insert. Rotation and scaling are  determined

by the insert. It appends transformed entities to the list  provided. In the

case of an arrayed insert, the number of items  appended is the number of

elements in the array; otherwise only  one entity is appended.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | the entity to be exploded    |

------------------------------------------------------------------------------

| REAL                   | base_pt[3]         | x, y, z coordinates of the   |

|                        |                    | base point                   |

------------------------------------------------------------------------------

| DXF_ENTITY             | insert             | the entity to be exploded    |

------------------------------------------------------------------------------

 

****** Output ******

 

------------------------------------------------------------------------------

| DML_LIST               | entitylist         | a list of entities; this     |

|                        |                    | list must be supplied by the  |

|                        |                    | user                         |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the entities were successfully created  and

appended to the list; otherwise it returns FALSE.

 

****** Example ******

 

#include <dmldefs.h>

#include <dxfdefs.h>

 

void array_entitylist ( entitylist, array_insert,

    base_pt, outlist )

 

DML_LIST entitylist;

DXF_ENTITY array_insert;

REAL base_pt[3];

DML_LIST outlist;

{

    DML_ITEM item;

    DXF_ENTITY entity;

 

    DML_WALK_LIST ( entitylist, item )

    {

          entity = dml_record ( item );

          dxf_explode_entities ( NULL, entity, base_pt,

                array_insert, outlist );

    }

}

This program explodes an entity as specified, and appends the  resulting list

of entities to a list.

 

***>> dxf_explode_entity <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_explode_entity ( file, entity, base_pt,  insert, i, j );

 

****** Description ******

 

This function rotates, translates and scales an entity. Translation  is

determined by the base point and insert. Rotation and scaling are  determined

by the insert. For non-arrayed inserts, i and  j should both be 0.  For

arrayed inserts, the entity returned  is the (i,j)th element.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | the entity to be exploded    |

------------------------------------------------------------------------------

| REAL                   | base_pt[3]         | x, y, z coordinates of the   |

|                        |                    | base point                   |

------------------------------------------------------------------------------

| DXF_ENTITY             | insert             | the entity to be exploded    |

------------------------------------------------------------------------------

| INT                    | i, j               | specifies ith row and jth    |

|                        |                    | column of insert array       |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the exploded entity. If an entity could not be  created,

NULL is returned.

 

@NEWPAGE =

 

****** Example ******

 

#include <dmldefs.h>

#include <dxfdefs.h>

 

void explode_entitylist ( entitylist, insert, base_pt, newlist )

 

DML_LIST entitylist;

DXF_ENTITY insert;

REAL base_pt[3];

DML_LIST newlist;

{

    DXF_ENTITY entity, entity1;

    DML_ITEM item;

 

    DML_WALK_LIST ( entitylist, item )

    {

          entity = dml_record ( item );

          entity1 = dxf_explode_entity ( NULL, entity, base_pt,

                insert, 0, 0 );

          dml_append_data ( newlist, ( ANY ) entity1 );

    }

}

This program explodes each entity on a list and appends each resulting

entity to another list.

 

***>> dxf_fclose <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_fclose ( file );

 

****** Description ******

 

This function closes an open DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; this file should  |

|                        |                    | be open                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns FALSE if the file was not open. Otherwise, it  returns

TRUE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          printf ( "DATA.DXF not found.\n" );

    else

          dxf_fclose ( file );

}

This program opens a DXF file and closes it.

 

***>> dxf_filter_add_type <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_filter_add_type ( filter, type );

 

****** Description ******

 

This function adds a type to the set of entity types accepted by a  filter.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILTER             | filter             | a filter; specifies layer,   |

|                        |                    | color and type of entities   |

|                        |                    | to be  accepted; see         |

|                        |                    | dxf_create_filter            |

------------------------------------------------------------------------------

| DXF_ENTITY_ID          | type               | type to be added; multiple   |

|                        |                    | types may be combined with   |

|                        |                    | the  bitwise-or (|) operator  |

------------------------------------------------------------------------------

 

See dxf_create_filter for valid type options.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dmldefs.h>

 

void read_entities ( file, outlist )

DXF_FILE file ;

DML_LIST outlist ;

{

    DXF_FILTER filter = dxf_create_filter ( DXF_CURVE,

          "1", DXF_ANY_COLOR );

    DML_LIST list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_filter_set_layer ( filter, "2" );

    dxf_filter_add_type ( filter, DXF_INSERT | DXF_POINT );

    dxf_filter_set_color ( filter, 15 );

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_free_filter ( filter );

}

This program creates a filter, gets qualified entities from the  ENTITIES

section of a DXF file, and appends them to a list. It  then changes the

filter and repeats the process.

 

***>> dxf_filter_set_color <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_filter_set_color ( filter, color );

 

****** Description ******

 

This function sets the color of a filter. The modified filter accepts  only

entities of the specified color.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILTER             | filter             | a filter; specifies layer,   |

|                        |                    | color and type of entities   |

|                        |                    | to be  accepted; see         |

|                        |                    | dxf_create_filter            |

------------------------------------------------------------------------------

| INT                    | color              | color to be accepted; 0 -    |

|                        |                    | 15, DXF_ANY_COLOR            |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

#include <dmldefs.h>

void read_entities ( file, outlist )

DXF_FILE file ;

DML_LIST outlist ;

{

    DXF_FILTER filter = dxf_create_filter ( DXF_CURVE,

          "1", DXF_ANY_COLOR );

          DML_LIST list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_filter_set_layer ( filter, "2" );

    dxf_filter_add_type ( filter, DXF_INSERT | DXF_POINT );

    dxf_filter_set_color ( filter, 15 );

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_free_filter ( filter );

}

This program creates a filter, gets qualified entities from the  ENTITIES

section of a DXF file, and appends them to a list. It  then changes the

filter and repeats the process.

 

***>> dxf_filter_set_layer <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_filter_set_layer ( filter, layer );

 

****** Description ******

 

This function sets the layer of a filter. The modified filter accepts

entities only from the specified layer.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILTER             | filter             | a filter; specifies layer,   |

|                        |                    | color and type of entities   |

|                        |                    | to be  accepted, see         |

|                        |                    | dxf_create_filter            |

------------------------------------------------------------------------------

| STRING                 | layer              | layer name; if NULL,         |

|                        |                    | entities from any layer will  |

|                        |                    | be  accepted                 |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

#include <dmldefs.h>

void read_entities ( file, outlist )

DXF_FILE file ;

DML_LIST outlist ;

{

    DXF_FILTER filter = dxf_create_filter ( DXF_CURVE,

          "1", DXF_ANY_COLOR );

    DML_LIST list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_filter_set_layer ( filter, "2" );

    dxf_filter_add_type ( filter, DXF_INSERT | DXF_POINT );

    dxf_filter_set_color ( filter, 15 );

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_free_filter ( filter );

}

This program creates a filter, gets qualified entities from the  ENTITIES

section of a DXF file, and appends them to a list. It  then changes the

filter and repeats the process.

 

***>> dxf_filter_set_type <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_filter_set_type ( filter, type );

 

****** Description ******

 

This function sets the type of a filter. The modified filter accepts  only

entities of the new type.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILTER             | filter             | a filter; specifies layer,   |

|                        |                    | color and type of entities   |

|                        |                    | to be  accepted; see         |

|                        |                    | dxf_create_filter            |

------------------------------------------------------------------------------

| DXF_ENTITY_ID          | type               | new type for filter;         |

|                        |                    | multiple types may be        |

|                        |                    | combined with the            |

|                        |                    | bitwise-or (|) operator      |

------------------------------------------------------------------------------

 

See dxf_create_filter for valid type options.

 

****** Example ******

 

#include <dxfdefs.h>

#include <dmldefs.h>

void read_entities ( file, outlist )

DXF_FILE file ;

DML_LIST outlist ;

{

    DXF_FILTER filter = dxf_create_filter ( DXF_CURVE,

          "1", DXF_ANY_COLOR );

    DML_LIST list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_filter_set_layer ( filter, "2" );

    dxf_filter_set_type ( filter, DXF_INSERT | DXF_POINT );

    dxf_filter_set_color ( filter, 15 );

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_free_filter ( filter );

}

This program creates a filter, gets qualified entities from the  ENTITIES

section of a DXF file, and appends them to a list. It  then changes the

filter and repeats the process.

 

***>> dxf_fopen <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_FILE dxf_fopen ( filename, mode );

 

****** Description ******

 

This function opens a DXF file for either reading or writing.  Mode must be

specified.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | filename           | name of DXF file             |

------------------------------------------------------------------------------

| DXF_FILE_MODE          | mode               | mode and format combined     |

|                        |                    | with bitwise-or (|) operator  |

------------------------------------------------------------------------------

 

Valid values for mode are:

 

______________________________________________________________________________

| Value                                | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_READ                             | open file for reading               |

| DXF_WRITE                            | open file for writing               |

------------------------------------------------------------------------------

 

Valid values for format are:

 

______________________________________________________________________________

| Value                                | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_ASCII                            | write in ASCII                      |

| DXF_BINARY                           | write in BINARY                     |

------------------------------------------------------------------------------

 

For reading, specify DXF_READ; for writing, specify DXF_WRITE with  DXF_ASCII

or DXF_BINARY, combined with the bitwise-or (|) operator.

 

****** Return Value ******

 

The return value is a DXF file pointer.  If the specified file could  not be

opened, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          printf ( "DATA.DXF not found.\n" );

    else

          dxf_fclose ( file );

}

This program opens DATA.DXF for reading and then closes it.

 

***>> dxf_free_block <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_free_block ( block );

 

****** Description ******

 

This function frees a block.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_BLOCK              | block              | a block to be freed          |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_BLOCK block;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    dxf_set_filepos ( file, NULL, DXF_FIRST_BLOCK );

 

    for ( block = dxf_get_block ( file, NULL );

          block != NULL;

          block = dxf_get_block ( file, NULL ) )

    {

          printf ( "%s\n", DXF_BLOCK_NAME(block) );

          dxf_free_block ( block );

    }

    dxf_fclose ( file );

}

This program gets each block in a DXF file, prints its name, and  frees the

block.

 

***>> dxf_free_descriptor <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_free_descriptor ( descriptor );

 

****** Description ******

 

This function frees a descriptor.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY_DESC        | descriptor         | a descriptor to be freed     |

------------------------------------------------------------------------------

 

****** 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 function creates a descriptor, writes a curve to a DXF file  using the

descriptor, and frees the descriptor.

 

***>> dxf_free_entity <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_free_entity ( entity );

 

****** Description ******

 

This function frees an entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity to be freed        |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL,  DXF_ANY_COLOR );

    DXF_ENTITY entity;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    dxf_set_filepos ( file, NULL, DXF_FIRST_ENTITY );

 

    for ( entity = dxf_get_entity ( file, filter );

          entity != NULL;

          entity = dxf_get_entity ( file, filter ) )

    {

          printf ( "%s\n", DXF_ENTITY_LAYER(entity) );

          dxf_free_entity ( entity );

    }

 

    dxf_fclose ( file );

    dxf_free_filter ( filter );

}

This program gets each entity from the ENTITIES section of  DATA.DXF, prints

each layer name, and frees each entity.

 

***>> dxf_free_filter <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_free_filter ( filter );

 

****** Description ******

 

This function frees a filter.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILTER             | filter             | a filter to be freed         |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

#include <dmldefs.h>

 

void read_entities ( file, outlist )

DXF_FILE file ;

DML_LIST outlist ;

{

    DXF_FILTER filter = dxf_create_filter ( DXF_CURVE,

          "1", DXF_ANY_COLOR );

    DML_LIST list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_filter_set_layer ( filter, "2" );

    dxf_filter_add_type ( filter, DXF_INSERT | DXF_POINT );

    dxf_filter_set_color ( filter, 15 );

    list = dxf_get_entities ( file, NULL, filter, NULL );

    dml_append_list ( outlist, list );

    dml_free_list ( list );

    dxf_free_filter ( filter );

}

This program creates a filter, gets qualified entities from the  ENTITIES

section of a DXF file, and appends them to a list. It  then changes the

filter and repeats the process. Then the filter is  freed.

 

***>> dxf_free_table_entry <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

void dxf_free_table_entry ( table_entry );

 

****** Description ******

 

This function frees a table entry.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_TABLE_ENTRY        | table_entry        | a table entry to be freed    |

------------------------------------------------------------------------------

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_TABLE_ENTRY te;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    dxf_set_filepos ( file, DXF_LAYER_TABLE_NAME,

          DXF_FIRST_TABLE_ENTRY );

 

    for ( te = dxf_get_table_entry ( file );

          te != NULL;

          te = dxf_get_table_entry ( file ) )

    {

          printf ( "%s\n", DXF_LAYER_LTYPE(te) );

          dxf_free_table_entry ( te );

    }

 

    dxf_fclose ( file );

}

 

This program opens a DXF file, gets each entry in the layer  table, prints

out its line type, and frees it.

 

***>> dxf_get_block <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_BLOCK dxf_get_block ( file, blockname );

 

****** Description ******

 

This function returns a specified block from a DXF file.

 

After this function returns, the DXF file is positioned at the next  block,

if any.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; this file should  |

|                        |                    | have been opened for reading  |

|                        |                    |  with dxf_fopen.             |

------------------------------------------------------------------------------

| STRING                 | blockname          | a block name; to select the  |

|                        |                    | current block, this          |

|                        |                    | parameter  should be NULL    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the selected block. If a non-existent block was

specified or if NULL was specified as a block name and the DXF file was not

positioned at a block, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

void main ( void )

{

    DXF_BLOCK block;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

    if ( file == NULL )

          return;

    dxf_set_filepos ( file, NULL, DXF_FIRST_BLOCK );

    for ( block = dxf_get_block ( file, NULL );

          block != NULL;

          block = dxf_get_block ( file, NULL ) )

    {

          printf ( "%s\n", DXF_BLOCK_NAME(block) );

          dxf_free_block ( block );

    }

    dxf_fclose ( file );

}

This program opens DATA.DXF for reading, gets each block and prints  its

blockname.

 

***>> dxf_get_blocks <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DML_LIST dxf_get_blocks ( file, blocklist );

 

****** Description ******

 

This function builds a list of the blocks in a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a dxf file; this file should  |

|                        |                    | have been opened with        |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| DML_LIST               | blocklist          | 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 blocklist 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 <dmldefs.h>

 

void main ( void )

{

    DML_LIST list;

    DML_ITEM item;

    DXF_BLOCK block;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

    if ( file == NULL )

          return;

    list = dxf_get_blocks ( file, NULL );

    DML_WALK_LIST ( list, item )

    {

          block = dml_record ( item );

          printf ( "%s\n", DXF_BLOCK_NAME(block) );

    }

    dml_destroy_list ( list, ( PF_VOID ) dxf_free_block );

    dxf_fclose ( file );

}

This program gets a list of blocks from DATA.DXF and prints their  names.

 

***>> dxf_get_entities <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DML_LIST dxf_get_entities ( file, blockname, filter,  entitylist );

 

****** Description ******

 

This function builds a list of entities from a DXF file. If a block  name is

specified, only that block is searched. If the block name is  NULL, only the

ENTITIES section of the file is searched. The  returned list contains only

entities qualified by the filter.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file; should have been   |

|                        |                    | opened for reading with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| STRING                 | blockname          | name of block to be read; if  |

|                        |                    | only entity section should   |

|                        |                    | be read, this  parameter     |

|                        |                    | should be NULL               |

------------------------------------------------------------------------------

| 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               | entitylist         | 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 entitylist 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 <dmldefs.h>

 

void main ( void )

{

    DML_LIST list;

    DML_ITEM item;

    DXF_ENTITY entity;

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    list = dxf_get_entities ( file, "B1", filter, NULL );

 

    DML_WALK_LIST ( list, item )

    {

          entity = dml_record ( item );

          printf ( "%s\n", DXF_ENTITY_LAYER(entity) );

    }

    dml_destroy_list ( list, ( PF_VOID ) dxf_free_entity );

    dxf_fclose ( file );

}

This program gets a list of entities from the block B1 in  DATA.DXF and

prints each entity's layer name.

 

***>> dxf_get_entity <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_get_entity ( file, filter );

 

****** Description ******

 

This function reads an entity from a DXF file.  The file must be  positioned

at an entity when this function is called.  The entity  returned is the first

entity qualified by the filter following 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; should have been  |

|                        |                    | opened for reading 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 the first entity qualified by the filter,  starting at

the current entity. If there were no qualified entities,  NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_FILTER filter = dxf_create_filter ( DXF_ALL_TYPES,

          NULL, DXF_ANY_COLOR );

    DXF_ENTITY entity;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    dxf_set_filepos ( file, NULL, DXF_FIRST_ENTITY );

 

    for ( entity = dxf_get_entity ( file, filter );

          entity != NULL;

          entity = dxf_get_entity ( file, filter ) )

    {

          printf ( "%s\n", DXF_ENTITY_LAYER(entity) );

          dxf_free_entity ( entity );

    }

 

    dxf_fclose ( file );

    dxf_free_filter ( filter );

}

This function prints the layer name of each entity in the  ENTITIES section

of DATA.DXF.

 

***>> dxf_get_entity_color <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

INT dxf_get_entity_color ( entity );

 

****** Description ******

 

This function returns an integer, from 0 to 15, corresponding to the  color

of the input entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is an integer, from 0 to 15, corresponding to the  color of

the input entity.

 

****** Example ******

 

#include <dmldefs.h>

#include <dxfdefs.h>

 

DML_LIST entities_color ( entities )

DML_LIST entities ;

{

    INT color ;

    DML_ITEM item ;

    DXF_ENTITY entity ;

    DML_LIST color_entities = dml_create_list();

 

    if ( color_entities == NULL )

          RETURN ( NULL ) ;

    printf ( "Enter chosen color\n" ) ;

    scanf ( "%d", &color ) ;

    DML_WALK_LIST ( entities, item ) {

          entity = (DXF_ENTITY)DML_RECORD(item) ;

          if ( dxf_get_entity_color ( entity ) == color ) {

                dml_append_data ( color_entities, entity ) ;

                dml_remove_item ( entities, item ) ;

          }

    }

    RETURN ( color_entities ) ;

}

This program builds a list of all the entities of a particular color  from

another list.

 

***>> dxf_get_entity_color_status <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

INT dxf_get_entity_color_status ( entity )

 

****** Description ******

 

This routine reports whether the color of an entity is specified "by  entity"

or "by layer".

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is DXF_COLOR_BYENT if the entity color is defined  by the

entity, and DXF_COLOR_BYLAYER if the entity color is defined  by its layer.

 

****** Example ******

 

************

 

***>> dxf_get_entity_elevation <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

REAL dxf_get_entity_elevation ( file, entity );

 

****** Description ******

 

This function returns a REAL which is the elevation of the input  entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a REAL which is the elevation of the entity.

 

****** Example ******

 

#include <dxfdefs.h>

 

void elevate_entities ( entities )

DML_LIST entities ;

{

    REAL h_old, h, h_new ;

    DML_ITEM item ;

    DXF_ENTITY entity ;

 

    printf ( "By how much do you want to elevate the entities?\n" ) ;

    scanf ( "%lf", &h ) ;

    DML_WALK_LIST ( entities, item ) {

          entity = (DXF_ENTITY)DML_RECORD(item) ;

          h_old = dxf_get_entity_elevation ( NULL, entity ) ;

          h_new = h_old + h ;

          dxf_set_entity_elevation ( NULL, entity, h_new ) ;

    }

}

This program changes the elevation of each entity on a list by a  specified

amount.

 

***>> dxf_get_entity_extrusion <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

REAL * dxf_get_entity_extrusion ( entity );

 

****** Description ******

 

This function returns a pointer to a REAL array which is the  extrusion

direction of the input entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a pointer to a REAL array which is the extrusion

direction of the entity.

 

****** Example ******

 

#include <dxfdefs.h>

 

void print_extrusion ( entity )

DXF_ENTITY entity ;

{

    REAL *extrusion ;

 

    extrusion = dxf_get_entity_extrusion ( entity ) ;

    printf ( "The extrusion is %lf %lf %lf\n",

          extrusion[0], extrusion[1], extrusion[2] ) ;

}

This program prints the extrusion direction of an entity.

 

***>> dxf_get_entity_handle <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

STRING dxf_get_entity_handle ( entity );

 

****** Description ******

 

This function returns the handle of an entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the entity handle. If no handle could be found,  NULL is

returned.

 

****** Example ******

 

#include <dxfdefs.h>

 

void print_handle ( entity )

DXF_ENTITY entity ;

{

    STRING handle ;

 

    handle = dxf_get_entity_handle ( entity ) ;

    printf ( "The handle is %s\n", handle ) ;

}

This program prints the handle of an entity.

 

***>> dxf_get_entity_layer <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

STRING dxf_get_entity_layer ( entity );

 

****** Description ******

 

This function returns the address of the layer name of the specified  entity.

 

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the layer name of the specified entity.

 

****** Example ******

 

#include <string.h>

#include <dxfdefs.h>

 

void move_entities_by_layer ( entities, layer0, layer1 )

DML_LIST entities ;

STRING layer0 ;

STRING layer1 ;

{

    DML_ITEM item ;

    DXF_ENTITY entity ;

    STRING layer ;

    DML_WALK_LIST ( entities, item ) {

          entity = (DXF_ENTITY)DML_RECORD(item) ;

          layer = dxf_get_entity_layer ( entity ) ;

          if ( strcmp ( layer, layer0 ) == 0 )

                dxf_set_entity_layer ( entity, layer1 ) ;

    }

}

This program changes all the entities of a specified layer in a list  to

another specified layer.

 

***>> dxf_get_entity_ltype <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

STRING dxf_get_entity_ltype ( entity );

 

****** Description ******

 

This entity returns the address of the line type name of an entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the line type name of the input entity.

 

****** Example ******

 

#include <string.h>

#include <dxfdefs.h>

void change_ltype ( entities, ltype_name0, ltype_name1 )

DML_LIST entities ;

STRING ltype_name0 ;

STRING ltype_name1 ;

{

    DML_ITEM item ;

    DXF_ENTITY entity ;

    STRING ltype_name ;

    DML_WALK_LIST ( entities, item ) {

          entity = (DXF_ENTITY)DML_RECORD(item) ;

          ltype_name = dxf_get_entity_ltype ( entity ) ;

          if ( strcmp ( ltype_name, ltype_name0 ) == 0 )

                dxf_set_entity_ltype ( entity, ltype_name1 ) ;

    }

}

This program changes all the entities of a specified line type in a  list to

another specified line type.

 

***>> dxf_get_entity_ltype_status <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

INT dxf_get_entity_ltype_status ( entity )

 

****** Description ******

 

This routine reports whether the line type of an entity is specified  "by

entity" or "by layer".

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is DXF_LTYPE_BYENT if the entity ltype is defined  by the

entity, and DXF_LTYPE_BYLAYER if the entity ltype is defined  by its layer.

 

****** Example ******

 

************

 

***>> dxf_get_entity_thickness <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

REAL dxf_get_entity_thickness ( entity );

 

****** Description ******

 

This function returns a REAL which is the thickness of the input  entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | an entity                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a REAL which is the thickness of the input  entity.

 

****** Example ******

 

#include <dxfdefs.h>

 

void double_thickness ( entities )

DML_LIST entities ;

{

    REAL w_old, w_new ;

    DML_ITEM item ;

    DXF_ENTITY entity ;

 

    DML_WALK_LIST ( entities, item ) {

          entity = (DXF_ENTITY)DML_RECORD(item) ;

          w_old = dxf_get_entity_thickness ( entity ) ;

          w_new = 2.0 * w_old ;

          dxf_set_entity_thickness ( entity, w_new ) ;

    }

}

This program doubles the thickness of the entities in a list.

 

***>> dxf_get_file_release <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

INT dxf_get_file_release ( file )

 

****** Description ******

 

This function reports the DXF version number used for creating  and writing

DXF objects. The version number of a file pointer can be  set using the

routine dxf_set_file_release.  When a file pointer is  created, the file

release is set to 11.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is 11 for DXF Release 11, and 10 for DXF Release  10.

 

****** Example ******

 

************

 

***>> dxf_get_filepos <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

char * dxf_get_filepos ( file );

 

****** Description ******

 

This function returns the file position of a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is a pointer which contains the file position of  the DXF

file.

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

    ANY position;

    if ( file == NULL )

          printf ( "DATA.DXF not found.\n" );

    else

    {

          dxf_set_filepos ( file, NULL, DXF_FIRST_ENTITY );

          position = dxf_get_filepos ( file );

          dxf_set_filepos ( file, DXF_LAYER_TABLE_NAME,

                 DXF_FIRST_TABLE_ENTRY );

          dxf_set_filepos ( file, position,

                DXF_RESTORE_POSITION );

          dxf_fclose ( file );

    }

}

This program gets and sets the file position of a DXF file.

 

***>> dxf_get_hdr_var <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

ANY dxf_get_hdr_var ( file, varname, data );

 

****** Description ******

 

This function reads the value of a header variable from a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

| STRING                 | varname            | the name of the DXF header   |

|                        |                    | variable name, including the  |

|                        |                    | '$'  character               |

------------------------------------------------------------------------------

| ANY                    | data               | memory for output data; this  |

|                        |                    | pointer must reference       |

|                        |                    | memory  large enough to hold  |

|                        |                    | the output data; use         |

|                        |                    | dxf_hdr_var_sizeof  to       |

|                        |                    | compute the size of output   |

|                        |                    | data                         |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns the address of the data if the variable was  located in

the DXF file header.  It returns NULL otherwise.

 

****** Example ******

 

#include <dxfdefs.h>

void main ( void )

{

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

    INT *data;

    if ( file == NULL ) printf ( "DATA.DXF not found.\n" );

    else {

          data = dxf_get_hdr_var ( file, "$FLATLAND",

                malloc ( dxf_hdr_var_sizeof ( "$FLATLAND" ) ) );

          if ( data != NULL ) {

          printf ( "%d\n", *data );

          free ( data );

          }

          dxf_fclose ( file );

    }

}

This program gets the value of header variable $FLATLAND.

 

***>> dxf_hdr_var_sizeof <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

INT dxf_hdr_var_sizeof ( varname );

 

****** Description ******

 

This function returns the size in bytes of the data stored under a  specified

header variable name.  This function should be used when  allocating space

for output for dxf_get_hdr_var.

 

****** Input ******

 

------------------------------------------------------------------------------

| STRING                 | varname            | the name of the DXF header   |

|                        |                    | variable name, including the  |

|                        |                    | '$'  character               |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns the address of the data if the variable was  located in

the DXF file header.  It returns FALSE otherwise.

 

****** Example ******

 

See dxf_get_hdr_var.

 

***>> dxf_get_precision <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

INT dxf_get_precision ( file );

 

****** Description ******

 

This function returns the output precision of a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is an integer which is the output precision of the  DXF

file.

 

****** Example ******

 

#include <dxfdefs.h>

 

void main ( void )

{

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

    INT precision ;

    if ( file == NULL )

          printf ( "DATA.DXF not found.\n" );

    else

    {

          precision = dxf_get_precision ( file );

 

          if ( precision < 4 )

                dxf_set_precision ( file, 4 );

 

          dxf_fclose ( file );

    }

}

This program reads the output precision of DATA.DXF and sets it to 4  if it

is less than 4.

 

***>> dxf_get_table_entries <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DML_LIST dxf_get_table_entries ( file,  table_entry_id, table_entry_list );

 

****** Description ******

 

This function builds a list of table entries from a DXF file of a  specified

type.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened with dxf_fopen        |

------------------------------------------------------------------------------

| DXF_TABLE_ENTRY_ID     | table_entry_id     | table type                   |

------------------------------------------------------------------------------

 

Valid options for table_id are:

 

______________________________________________________________________________

| Value                                | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_LTYPE                            | line type table entry               |

| DXF_LAYER                            | layer table entry                   |

| DXF_STYLE                            | style table entry                   |

| DXF_VIEW                             | view table entry                    |

| DXF_UCS                              | user coordinate system table entry  |

| DXF_VPORT                            | viewport table entry                |

------------------------------------------------------------------------------

 

------------------------------------------------------------------------------

| DML_LIST               | table_entry_list   | 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 table_entry_list 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 <dmldefs.h>

 

void main ( void )

{

    DML_LIST list;

    DML_ITEM item;

    DXF_TABLE_ENTRY te;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

 

    if ( file == NULL )

          return;

 

    list = dxf_get_table_entries ( file, DXF_LAYER, NULL );

 

    DML_WALK_LIST ( list, item )

    {

          te = dml_record ( item );

          printf ( "%s\n", DXF_LAYER_LTYPE(te) );

    }

 

    dml_destroy_list ( list, ( PF_VOID ) dxf_free_table_entry );

    dxf_fclose ( file );

}

This program builds a list of the LAYER table entries in  DATA.DXF and prints

each entry's line type.

 

***>> dxf_get_table_entry <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_TABLE_ENTRY dxf_get_table_entry ( file );

 

****** Description ******

 

This function reads the current table entry from a DXF file.  The  file must

be positioned at a table entry when this routine is called.

 

After this function returns, the DXF file is positioned at the next  table

entry, if any.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for reading with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the current table entry. If a table entry could  not be

found, NULL is returned.

 

****** Example ******

 

#include <dxfdefs.h>

void main ( void )

{

    DXF_TABLE_ENTRY te;

    DXF_FILE file = dxf_fopen ( "DATA.DXF", DXF_READ );

    if ( file == NULL )

          return;

    dxf_set_filepos ( file, DXF_LAYER_TABLE_NAME,

          DXF_FIRST_TABLE_ENTRY );

    for ( te = dxf_get_table_entry ( file );

          te != NULL;

          te = dxf_get_table_entry ( file ) )

    {

          printf ( "%s\n", DXF_LAYER_LTYPE(te) );

          dxf_free_table_entry ( te );

    }

    dxf_fclose ( file );

}

This program prints the line type of each layer in DATA.DXF.

 

***>> dxf_insert_add_attrib <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_insert_add_attrib ( file, insert, text_pt,  height, text, tag,

flags, length, angle, scale, style_name  );

 

****** Description ******

 

This function creates an ATTRIB entity with the specified  properties, and

appends it to an INSERT entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| DXF_ENTITY             | insert             | INSERT entity to append      |

|                        |                    | ATTRIB to                    |

------------------------------------------------------------------------------

| REAL                   | text_pt[3]         | x, y, z coordinates of text  |

|                        |                    | insertion point              |

------------------------------------------------------------------------------

| REAL                   | height             | height of characters         |

------------------------------------------------------------------------------

| STRING                 | text               | attribute default value      |

------------------------------------------------------------------------------

| STRING                 | tag                | tag string                   |

------------------------------------------------------------------------------

| INT                    | flags              | attribute flags              |

------------------------------------------------------------------------------

| INT                    | length             | field length                 |

------------------------------------------------------------------------------

| REAL                   | angle              | angle of text                |

------------------------------------------------------------------------------

| REAL                   | scale              | relative x scale factor      |

------------------------------------------------------------------------------

| STRING                 | style_name         | text style name              |

------------------------------------------------------------------------------

 

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                        |

------------------------------------------------------------------------------

 

These options may be combined with the bitwise-or (|) operator.

 

****** Return Value ******

 

The return value is the created ATTRIB entity, appended to the  INSERT

entity. If memory could not be  allocated to create the entity, NULL is

returned.

 

****** Example ******

 

#include <dxfdefs.h>

DXF_ENTITY create_insert ( void )

{

    REAL insert_pt[3], text_pt[3], height ;

    DXF_ENTITY insert ;

    char block_name[32], text[32], tag[32], response ;

    printf ( "Enter the block name\n" ) ;

    scanf ( "%s", block_name ) ;

    printf ( "Enter x and y coordinates of the insert point\n" ) ;

    scanf ( "%lf%lf", insert_pt, insert_pt+1 ) ;

    insert_pt[2] = 0.0 ;

    insert = dxf_create_insert ( NULL, block_name, insert_pt, 1.0,

          0.0, 1, 1, 0.0, 0.0 ) ;

    while ( TRUE ) {

          printf ( "Do you want ao add an attribute?\n" ) ;

          scanf ( "%c", &response ) ;

          if ( response != 'y' )

                RETURN ( insert ) ;

          printf ( "Enter the x and y coordinates " );

          printf ( "of the text start point\n");

          scanf ( "%lf%lf", text_pt, text_pt+1 ) ;

          text_pt[2] = 0.0 ;

          printf ( "Enter text height\n");

          scanf ( "%lf", &height ) ;

          printf ( "Enter the text\n");

          scanf ( "%s", text ) ;

          printf ( "Enter the attribute tag\n");

          scanf ( "%s", tag ) ;

          dxf_insert_add_attrib ( NULL, insert, text_pt, height,

                text, tag, 0, 0, 0.0, 1.0, NULL ) ;

    }

    RETURN ( insert ) ;

}

This program creates an insert with specified properties, and,  optionally,

adds an ATTRIB entity to it.

 

***>> dxf_open_block <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_open_block ( file, name, layer, flags, base_pt );

 

****** Description ******

 

This function opens a block for writing in a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| STRING                 | name               | block name                   |

------------------------------------------------------------------------------

| STRING                 | layer              | block layer                  |

------------------------------------------------------------------------------

| INT                    | flags              | block flag                   |

------------------------------------------------------------------------------

| REAL                   | base_pt[3]         | block base point             |

------------------------------------------------------------------------------

 

Valid options for block flags, which may be combined  with the bitwise-or (|)

operator, are:

 

______________________________________________________________________________

| Flag Option                          | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_BLOCK_IS_ANON                    | anonymous block                     |

| DXF_BLOCK_HAS_ATTRS                  | indicates that block has            |

|                                      | attributes                          |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the block was successfully opened,  otherwise

it returns false.

 

****** Example ******

 

#include <dxfdefs.h>

 

void entities_to_block ( file, entities )

DXF_FILE file ;

DML_LIST entities ;

{

    char name[32], layer[32] ;

    REAL base_pt[3] ;

 

    printf ( "Enter the block name\n" ) ;

    scanf ( "%s", name ) ;

    printf ( "Enter the block layer\n" ) ;

    scanf ( "%s", layer ) ;

    printf ( "Enter the base point of the block\n" ) ;

    scanf ( "%lf%lf%lf", base_pt, base_pt+1, base_pt+2 ) ;

    dxf_open_block ( file, name, layer, 0, base_pt ) ;

    if ( !dxf_put_entities ( file, entities ) )

          printf ( "Error writing entities\n" ) ;

    dxf_close_block ( file ) ;

}

This program opens a block with specified properties in a DXF file  and

writes a list of entities into it.

 

***>> dxf_open_blocks <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_open_blocks ( file );

 

****** Description ******

 

This function opens the BLOCKS section of a DXF file for  writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the BLOCKS section was  successfully opened,

otherwise it returns FALSE.

 

****** Example ******

 

#include <dxfdefs.h>

void put_block ( file, name, layer, base_pt, entities )

DXF_FILE file ;

DML_LIST entities ;

char name[32], layer[32] ;

REAL base_pt[3] ;

{

    if ( !dxf_open_blocks ( file ) ) {

          printf ( "Could not open BLOCKS section\n" );

          return;

    }

    dxf_open_block ( file, name, layer, 0, base_pt ) ;

    if ( !dxf_put_entities ( file, entities ) )

          printf ( "Error writing entities\n" );

    dxf_close_block ( file ) ;

    dxf_close_blocks ( file ) ;

}

This program opens a block with specified properties in a DXF file  and

writes a list of entities into it.

 

***>> dxf_open_entities <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_open_entities ( file );

 

****** Description ******

 

This function opens the ENTITIES section of a DXF file for  writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened with dxf_fopen        |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the ENTITIES section was  successfully opened,

otherwise it returns FALSE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_entities ( file, entities )

DXF_FILE file ;

DML_LIST entities ;

{

    if ( !dxf_open_entities ( file ) ) {

          printf ( "Cannot open ENTITIES section\n" );

          return;

    }

    if ( !dxf_put_entities ( file, entities ) )

          printf ( "Error writing entities\n" );

    dxf_close_entities ( file ) ;

}

This program opens the ENTITIES section of a file and writes a  list of

entities to it.

 

***>> dxf_open_header <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_open_header ( file );

 

@HEADIOG = Description

 

This function opens the HEADER section of a DXF file for  writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               |  a DXF file; should have     |

|                        |                    | been opened for writing with  |

|                        |                    |  dxf_fopen                   |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the HEADER section was  successfully opened,

otherwise it returns false.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_header ( file )

DXF_FILE file ;

{

    INT data = 0;

    if ( !dxf_open_header ( file ) )

          printf ( "Open HEADER section\n" );

          dxf_put_hdr_var ( file, "$FLATLAND",

                ( ANY ) &data );

    dxf_close_header ( file ) ;

}

This program opens the HEADER section of a file, writes a  value for

$FLATLAND, and then closes the file.

 

***>> dxf_open_table <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_open_table ( file, table_id, max_count );

 

****** Description ******

 

This function opens a table in a DXF file for writing.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened with dxf_fopen        |

------------------------------------------------------------------------------

| DXF_TABLE_ENTRY_ID     | table_id           | type of table to be opened   |

------------------------------------------------------------------------------

| INT                    | count              | the number of table entries  |

|                        |                    | that will be written; up to  |

|                        |                    | this  number of table        |

|                        |                    | entries may be written to    |

|                        |                    | the open table               |

------------------------------------------------------------------------------

 

Valid options for table_id are:

 

______________________________________________________________________________

| Constant                             | Meaning                             |

|----------------------------------------------------------------------------|

| DXF_LTYPE                            | linetype table                      |

| DXF_LAYER                            | layer table                         |

| DXF_STYLE                            | text style table                    |

| DXF_VIEW                             | view table                          |

| DXF_UCS                              | UCS table                           |

| DXF_VPORT                            | viewport table                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is TRUE if the table was opened.  It is false  otherwise.

 

****** Example ******

 

#include <dxfdefs.h>

void put_ltypes ( file, ltypes )

DXF_FILE file ;

DML_LIST ltypes ;

{

    if ( !dxf_open_tables ( file ) ) {

          printf ( "Cannot open the TABLES section\n" );

          return;

    }

    if ( !dxf_open_table ( file, DXF_LTYPE,

          dml_length(ltypes) ) ) {

          printf ( "Cannot open the linetype table\n" ) ;

          return;

    }

    if ( !dxf_put_table_entries ( file, ltypes ) )

          printf ( "Error writing line types\n" );

    dxf_close_table ( file ) ;

    dxf_close_tables ( file ) ;

}

This program opens the line type table in a DXF file and writes a  list of

line types to it.

 

***>> dxf_open_tables <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_open_tables ( file );

 

****** Description ******

 

This function opens the TABLES section of a DXF file for  writing

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the TABLES section was  successfully opened.

Otherwise it returns FALSE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_tables ( file )

DXF_FILE file ;

{

    if ( !dxf_open_tables ( file ) ) {

          printf ( "Cannot open TABLES section\n" );

          return;

    }

    dxf_close_tables ( file ) ;

}

This program opens the TABLES section of a DXF file and then  closes it.

 

***>> dxf_polyline_add_vertex <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

DXF_ENTITY dxf_polyline_add_vertex ( file, polyline, pt,  bulge, flags );

 

****** Description ******

 

This function creates a VERTEX entity, and appends it to a POLYLINE  entity.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | pointer to a DXF file; may   |

|                        |                    | be NULL                      |

------------------------------------------------------------------------------

| DXF_ENTITY             | polyline           | a polyline                   |

------------------------------------------------------------------------------

| REAL                   | pt[3]              | x, y, z coordinates of the   |

|                        |                    | vertex to be added           |

------------------------------------------------------------------------------

| REAL                   | bulge              | the bulge is the tangent of  |

|                        |                    | one fourth of the desired    |

|                        |                    | arc  sweep; this parameter   |

|                        |                    | applies to polyline modes    |

|                        |                    | that allow arcs,  otherwise  |

|                        |                    | it should be 0               |

------------------------------------------------------------------------------

| INT                    | flags              | polyline flags               |

------------------------------------------------------------------------------

 

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                        | 3D polyline vertex                  |

| DXF_VERTEX_3D_MESH                   | 3D mesh vertex                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is the added VERTEX entity.  It is NULL if  the entity could

not be created.

 

****** Example ******

 

#include <dxfdefs.h>

 

DXF_ENTITY create_polyline ( points )

DML_LIST points ;

{

    INT flags, type ;

    DXF_ENTITY polyline ;

    DML_ITEM item ;

    char response ;

    REAL *point ;

 

    flags = 0 ;

    printf ( "Will the polyline be closed\n" ) ;

    scanf ( "%c", &response ) ;

    if ( response == 'y' )

          flags = DXF_PLINE_CLSD ;

    printf ( "Is it a cubic(c) or quadratic(q) " );

    printf ( "spline or a polygon?\n" ) ;

    scanf ( "%c", &response ) ;

    if ( response == 'c' )

          type = DXF_PLINE_CUBIC ;

    else if ( response == 'q' )

          type = DXF_PLINE_QUADR ;

    else

          type = DXF_PLINE_NSMOOTH ;

    polyline = dxf_create_polyline ( NULL, flags, type ) ;

 

    DML_WALK_LIST ( points, item ) {

          point = (REAL*)DML_RECORD(item) ;

          dxf_polyline_add_vertex ( NULL, polyline, point, 0.0, 0 ) ;

    }

    RETURN ( polyline ) ;

}

This program creates a polyline of specified properties and adds  vertices

from a list of points to it.

 

***>> dxf_put_3dface <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_3dface ( file, pt0[3], pt1[3],  pt2[3], pt3[3], flags )

 

****** Description ******

 

This function writes a 3DFACE entity to a DXF file.  The ENTITIES  section

must be open when this function is called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| REAL                   | pt0[3]             | first corner                 |

------------------------------------------------------------------------------

| REAL                   | pt1[3]             | second corner                |

------------------------------------------------------------------------------

| REAL                   | pt2[3]             | third corner                 |

------------------------------------------------------------------------------

| REAL                   | pt3[3]             | fourth corner                |

------------------------------------------------------------------------------

| INT                    | flags              | flags; see DXF_3DFACE object  |

|                        |                    | type definition for valid    |

|                        |                    | options                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is TRUE if the entity was written successfully.  It  is

FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_appid <<***

 

****** Summary ******

 

include <dxfdefs.h>

 

BOOLEAN dxf_put_appid ( file, name )

 

****** Description ******

 

This function writes an application id (APPID) table entry to a DXF  file.

The application id table must be open when this routine is  called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| STRING                 | name               | application id name          |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is TRUE if the application id table entry was  written

successfully.  It is FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_arc <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_arc ( file, ctr[3], rad, ang0, ang1  )

 

******  Description ******

 

This function writes an ARC entity to a DXF file.  The ENTITIES  section must

be open when this function is called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| REAL                   | ctr[3]             | center                       |

------------------------------------------------------------------------------

| REAL                   | rad                | radius                       |

------------------------------------------------------------------------------

| REAL                   | ang0               | start angle in degrees       |

------------------------------------------------------------------------------

| REAL                   | ang1               | end angle in degrees         |

------------------------------------------------------------------------------

 

****** Return Value ******

 

The return value is TRUE if the entity was successfully written.  It  is

FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_attdef <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_attdef ( file, text_pt[3], height, text,  prompt, tag, flags,

len, ang, scale, style_name )

 

****** Description ******

 

This function writes an ATTDEF entity to a DXF file.  The ENTITIES  section

must be open when this function is called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| REAL                   | text_pt[3]         | placement point              |

------------------------------------------------------------------------------

| REAL                   | height             | text height                  |

------------------------------------------------------------------------------

| STRING                 | text               | text value                   |

------------------------------------------------------------------------------

| STRING                 | prompt             | prompt string                |

------------------------------------------------------------------------------

| STRING                 | tag                | tag                          |

------------------------------------------------------------------------------

| INT                    | flags              | flags; see DXF_ATTDEF object  |

|                        |                    | type definition for valid    |

|                        |                    | options                      |

------------------------------------------------------------------------------

| INT                    | len                | maximum field length         |

------------------------------------------------------------------------------

| REAL                   | ang                | text angle in degrees        |

------------------------------------------------------------------------------

| REAL                   | scale              | text scale                   |

------------------------------------------------------------------------------

| STRING                 | style_name         | text style name              |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the entity was successfully created.  It is

FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_circle <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_circle ( file, ctr[3], rad )

 

****** Description ******

 

This function writes a CIRCLE entity to a DXF file.  The ENTITIES  section

must be open when this function is called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer              |

|                        |                    |                              |

------------------------------------------------------------------------------

| REAL                   | ctr[3]             | center                       |

------------------------------------------------------------------------------

| REAL                   | rad                | radius                       |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the entity was successfully created.  It is

FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_comment <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_comment ( file, comment );

 

****** Description ******

 

This function writes a comment to a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| STRING                 | comment            | comment text                 |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the comment was successfully written,

otherwise it returns FALSE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_comment ( file )

DXF_FILE file ;

{

    if ( !dxf_put_comment ( file, "This is a comment" ) )

          printf ( "Error writing comment.\n" );

}

This program puts a comment into a DXF file.

 

***>> dxf_put_dimension <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_dimension ( file, name, def_pt[3],  mid_pt[3], insert_pt[3],

type, text, def_pt3[3], def_pt4[3],  def_pt5[3], def_pt6[3], ldr_len, ang )

 

****** Description ******

 

This function writes a DIMENSION entity to a DXF file.  The ENTITIES  section

must be open when this function is called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| STRING                 | name               | DIMSTYLE name                |

------------------------------------------------------------------------------

| REAL                   | def_pt[3]          | definition point             |

------------------------------------------------------------------------------

| REAL                   | mid_pt[3]          | mid-point                    |

------------------------------------------------------------------------------

| REAL                   | insert_pt[3]       | insertion point              |

------------------------------------------------------------------------------

| INT                    | type               | dimension type               |

------------------------------------------------------------------------------

| STRING                 | text               | dimension text               |

------------------------------------------------------------------------------

| REAL                   | def_pt3[3]         | definition point 3           |

------------------------------------------------------------------------------

| REAL                   | def_pt4[3]         | definition point 4           |

------------------------------------------------------------------------------

| REAL                   | def_pt5[3]         | definition point 5           |

------------------------------------------------------------------------------

| REAL                   | def_pt6[3]         | definition point 6           |

------------------------------------------------------------------------------

| REAL                   | ldr_len            | leader length                |

------------------------------------------------------------------------------

| REAL                   | ang                | angle in degrees             |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the entity was successfully created.   It is

FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_dimstyle <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_dimstyle ( file, name, dimpost, dimapost,  dimblk, dimblk1,

dimblk2, scale )

 

****** Description ******

 

This function writes a DIMSTYLE table entry to a DXF file.  The  DIMSTYLE

table must be open when this function is called.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | DXF file pointer             |

------------------------------------------------------------------------------

| STRING                 | name               | DIMSTYLE name                |

------------------------------------------------------------------------------

| STRING                 | dimpost            | dimension text suffix        |

------------------------------------------------------------------------------

| STRING                 | dimapost           | alternate units text suffix  |

------------------------------------------------------------------------------

| STRING                 | dimblk             | arrow block name             |

------------------------------------------------------------------------------

| STRING                 | dimblk1            | separate arrow block 1 name  |

------------------------------------------------------------------------------

| STRING                 | dimblk2            | separate arrow block 2 name  |

------------------------------------------------------------------------------

| REAL                   | scale              | scale                        |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the table entry was successfully  created.  It

is FALSE otherwise.

 

****** Example ******

 

************

 

***>> dxf_put_entities <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_entities ( file, entitieslist );

 

****** Description ******

 

This function writes a list of entities to a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened for writing with      |

|                        |                    | dxf_fopen                    |

------------------------------------------------------------------------------

| DML_LIST               | entitieslist       | the list of entities to be   |

|                        |                    | written                      |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the entities were successfully written,

otherwise it returns FALSE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_entities ( file, entities )

DXF_FILE file ;

DML_LIST entities ;

{

    if ( !dxf_put_entities ( file, entities ) )

          printf ( "Error writing entities\n" );

}

This program writes a list of entities to a DXF file.

 

***>> dxf_put_entity <<***

 

****** Summary ******

 

#include <dxfdefs.h>

 

BOOLEAN dxf_put_entity ( file, entity );

 

****** Description ******

 

This function writes an entity to a DXF file.

 

****** Input ******

 

------------------------------------------------------------------------------

| DXF_FILE               | file               | a DXF file; should have been  |

|                        |                    | opened with dxf_fopen        |

------------------------------------------------------------------------------

| DXF_ENTITY             | entity             | the entity to be written     |

------------------------------------------------------------------------------

 

****** Return Value ******

 

This function returns TRUE if the entity was successfully written.

Otherwise it returns FALSE.

 

****** Example ******

 

#include <dxfdefs.h>

 

void put_entity ( file, entity )

DXF_FILE file ;

DXF_ENTITY entity ;

{

    if ( !dxf_put_entity ( file, entity ) )

          printf ( "Error writing entity\n" );

}

This program writes an entity to a DXF file.