libDXF 0.0.1
A library with DXF related functions written in C.
Data Structures | Typedefs | Functions

endblk.h File Reference

Header file for a DXF end of block marker entity (ENDBLK). More...

#include "global.h"
#include "util.h"
Include dependency graph for endblk.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dxf_endblk_struct
 DXF definition of an AutoCAD end block entity. More...

Typedefs

typedef struct dxf_endblk_struct DxfEndblk
 DXF definition of an AutoCAD end block entity.

Functions

DxfEndblkdxf_endblk_new ()
 Allocate memory for a DxfEndblk (a DXF ENDBLK entity).
DxfEndblkdxf_endblk_init (DxfEndblk *endblk)
 Allocate memory and initialize data fields in a DxfEndblk (a DXF ENDBLK entity).
DxfEndblkdxf_endblk_read (DxfFile *fp, DxfEndblk *endblk)
 Read data from a DXF file into a DxfEndblk (a DXF ENDBLK entity).
int dxf_endblk_write (DxfFile *fp, DxfEndblk *endblk)
 Write DXF output to a file for an end of block marker (a DXF ENDBLK entity).
int dxf_endblk_free (DxfEndblk *endblk)
 Free the allocated memory for a DxfEndblk (a DXF ENDBLK entity) and all it's data fields.
int dxf_endblk_get_id_code (DxfEndblk *endblk)
 Get the ID code from a DxfEndblk (a DXF ENDBLK entity).
DxfEndblkdxf_endblk_set_id_code (DxfEndblk *endblk, int id_code)
 Set the ID code for a DxfEndblk (a DXF ENDBLK entity).
char * dxf_endblk_get_layer (DxfEndblk *endblk)
 Get the layer from a DxfEndblk (a DXF ENDBLK entity).
DxfEndblkdxf_endblk_set_layer (DxfEndblk *endblk, char *layer)
 Set the layer for a DxfEndblk (a DXF ENDBLK entity).
char * dxf_endblk_get_dictionary_owner_soft (DxfEndblk *endblk)
 Get the soft pointer to the dictionary owner from a DxfEndblk (a DXF ENDBLK entity).
DxfEndblkdxf_endblk_set_dictionary_owner_soft (DxfEndblk *endblk, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DxfEndblk (a DXF ENDBLK entity).

Detailed Description

Header file for a DXF end of block marker entity (ENDBLK).

Author:
Copyright (C) 2014, 2015, 2016, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.

Copyright Notices.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.,
59 Temple Place,
Suite 330,
Boston,
MA 02111 USA.

Drawing eXchange Format (DXF) is a defacto industry standard for the exchange of drawing files between various Computer Aided Drafting programs.
DXF is an industry standard designed by Autodesk(TM).
For more details see http://www.autodesk.com.


Definition in file endblk.h.


Typedef Documentation

typedef struct dxf_endblk_struct DxfEndblk

DXF definition of an AutoCAD end block entity.

The Blocks section of the DXF file contains all the Block Definitions.
This section contains the entities that make up the Blocks used in the drawing, including anonymous Blocks generated by the HATCH command and by associative dimensioning.
The format of the entities in this section is identical to those in the Entities section described later, so see that section for details.
All entities in the Blocks section appear between Block and Endblk entities.
Block and Endblk entities appear only in the Blocks section.
Block definitions are never nested (that is, no Block or Endblk entity ever appears within another Block-Endblk pair), although a Block definition can contain an INSERT entity.

External References are written in the DXF file as any Block Definition, except they also include a text string (group code 1) of the path and filename of the External Reference.

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.

Function Documentation

DxfEndblk* dxf_endblk_new ( )

Allocate memory for a DxfEndblk (a DXF ENDBLK entity).

Fill the memory contents with zeros.

Returns:
Pointer to the memory occupied by the DxfEndblk.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.

Definition at line 53 of file endblk.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_block_init(), dxf_endblk_init(), and dxf_endblk_read().

DxfEndblk* dxf_endblk_init ( DxfEndblk endblk)

Allocate memory and initialize data fields in a DxfEndblk (a DXF ENDBLK entity).

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblkPointer to the DXF end of block marker entity

Definition at line 97 of file endblk.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, dxf_endblk_new(), dxf_endblk_set_dictionary_owner_soft(), dxf_endblk_set_id_code(), and dxf_endblk_set_layer().

Referenced by dxf_endblk_read().

Here is the call graph for this function:

DxfEndblk* dxf_endblk_read ( DxfFile fp,
DxfEndblk endblk 
)

Read data from a DXF file into a DxfEndblk (a DXF ENDBLK entity).

The last line read from file contained the string "ENDBLK".
Now follows some data for the ENDBLK, to be terminated with a " 0" string announcing the following entity, or the end of the ENTITY section marker ENDSEC.
While parsing the DXF file store data in endblk.

Returns:
a pointer to endblk.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Todo:
After reading information from the BLOCK entity up until the closing Group code 0, the pointer to the following ENDBLK entity needs to be stored in the current (last) DxfBlock struct member endblk.
Parameters:
fpDXF file pointer to an input file (or device).
endblkPointer to the DXF end of block marker entity

Definition at line 154 of file endblk.c.

References _, dxf_endblk_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, dxf_endblk_init(), dxf_endblk_new(), dxf_file_struct::filename, dxf_file_struct::fp, dxf_endblk_struct::id_code, dxf_endblk_struct::layer, and dxf_file_struct::line_number.

Here is the call graph for this function:

int dxf_endblk_write ( DxfFile fp,
DxfEndblk endblk 
)

Write DXF output to a file for an end of block marker (a DXF ENDBLK entity).

Appears only in BLOCKS section.

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.

Todo:
for version R14.
Implementing the start of application-defined group "{application_name", with Group code 102.
For example: "{ACAD_REACTORS" indicates the start of the AutoCAD persistent reactors group.

application-defined codes: Group codes and values within the 102 groups are application defined (optional).

End of group, "}" (optional), with Group code 102.

Parameters:
fpDXF file pointer to an output file (or device).
endblkPointer to the DXF end of block marker entity

Definition at line 255 of file endblk.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_endblk_get_id_code(), dxf_endblk_get_layer(), and dxf_file_struct::fp.

Referenced by dxf_block_write().

Here is the call graph for this function:

int dxf_endblk_free ( DxfEndblk endblk)

Free the allocated memory for a DxfEndblk (a DXF ENDBLK entity) and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblkPointer to the DXF end of block marker entity

Definition at line 324 of file endblk.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_endblk_get_dictionary_owner_soft(), and dxf_endblk_get_layer().

Here is the call graph for this function:

int dxf_endblk_get_id_code ( DxfEndblk endblk)

Get the ID code from a DxfEndblk (a DXF ENDBLK entity).

Returns:
ID code.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblka pointer to a DxfEndblk (a DXF ENDBLK entity).

Definition at line 364 of file endblk.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_endblk_struct::id_code.

Referenced by dxf_endblk_write().

DxfEndblk* dxf_endblk_set_id_code ( DxfEndblk endblk,
int  id_code 
)

Set the ID code for a DxfEndblk (a DXF ENDBLK entity).

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblka pointer to a DxfEndblk (a DXF ENDBLK entity).
id_codeIdentification number for the entity.
This is to be an unique (sequential) number in the DXF file.

Definition at line 408 of file endblk.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_ellipse_struct::id_code, and dxf_endblk_struct::id_code.

Referenced by dxf_endblk_init().

char* dxf_endblk_get_layer ( DxfEndblk endblk)

Get the layer from a DxfEndblk (a DXF ENDBLK entity).

Returns:
layer when sucessful, NULL when an error occurred.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblka pointer to a DxfEndblk (a DXF ENDBLK entity).

Definition at line 456 of file endblk.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_endblk_struct::layer.

Referenced by dxf_endblk_free(), and dxf_endblk_write().

DxfEndblk* dxf_endblk_set_layer ( DxfEndblk endblk,
char *  layer 
)

Set the layer for a DxfEndblk (a DXF ENDBLK entity).

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblka pointer to a DxfEndblk (a DXF ENDBLK entity).
layera string containing the layer for the entity.

Definition at line 500 of file endblk.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_endblk_struct::layer.

Referenced by dxf_endblk_init().

char* dxf_endblk_get_dictionary_owner_soft ( DxfEndblk endblk)

Get the soft pointer to the dictionary owner from a DxfEndblk (a DXF ENDBLK entity).

Returns:
soft pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblka pointer to a DxfEndblk (a DXF ENDBLK entity).

Definition at line 549 of file endblk.c.

References _, dxf_endblk_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_endblk_free().

DxfEndblk* dxf_endblk_set_dictionary_owner_soft ( DxfEndblk endblk,
char *  dictionary_owner_soft 
)

Set the pointer to the dictionary_owner_soft for a DxfEndblk (a DXF ENDBLK entity).

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
endblka pointer to a DxfEndblk (a DXF ENDBLK entity).
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the entity.

Definition at line 594 of file endblk.c.

References _, dxf_endblk_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_endblk_init().