libDXF 0.0.1
A library with DXF related functions written in C.
Functions

vertex.c File Reference

Functions for a DXF vertex entity (VERTEX). More...

#include "vertex.h"
Include dependency graph for vertex.c:

Go to the source code of this file.

Functions

DxfVertexdxf_vertex_new ()
 Allocate memory for a DxfVertex.
DxfVertexdxf_vertex_init (DxfVertex *vertex)
 Allocate memory and initialize data fields in a VERTEX entity.
DxfVertexdxf_vertex_read (DxfFile *fp, DxfVertex *vertex)
 Read data from a DXF file into an VERTEX entity.
int dxf_vertex_write (DxfFile *fp, DxfVertex *vertex)
 Write DXF output to fp for a vertex entity.
int dxf_vertex_free (DxfVertex *vertex)
 Free the allocated memory for a VERTEX entity and all it's data fields.
.
void dxf_vertex_free_chain (DxfVertex *vertices)
 Free the allocated memory for a chain of DXF VERTEX entities and all their data fields.

Detailed Description

Functions for a DXF vertex entity (VERTEX).

Author:
Copyright (C) 2008, 2010, 2012, 2013, 2014, 2015, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Copyright (C) 2010 by Luis Matos <gass@otiliamatos.ath.cx>.

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 vertex.c.


Function Documentation

DxfVertex* dxf_vertex_new ( )

Allocate memory for a DxfVertex.

Fill the memory contents with zeros.

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 vertex.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_donut_write(), dxf_lwpolyline_init(), dxf_lwpolyline_read(), dxf_polyline_init(), dxf_vertex_init(), and dxf_vertex_read().

DxfVertex* dxf_vertex_init ( DxfVertex vertex)
DxfVertex* dxf_vertex_read ( DxfFile fp,
DxfVertex vertex 
)

Read data from a DXF file into an VERTEX entity.

The last line read from file contained the string "VERTEX".
Now follows some data for the VERTEX, 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 vertex.

Returns:
a pointer to vertex.
Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
fpfilepointer to the input file (or device).
vertexa pointer to the DXF VERTEX entity.

Definition at line 165 of file vertex.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_11, AutoCAD_13, dxf_vertex_struct::bulge, dxf_vertex_struct::color, dxf_vertex_struct::curve_fit_tangent_direction, dxf_vertex_struct::dictionary_owner_hard, dxf_vertex_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, DXF_DEFAULT_LINETYPE, dxf_vertex_init(), dxf_vertex_new(), dxf_vertex_struct::elevation, dxf_vertex_struct::end_width, dxf_file_struct::filename, dxf_vertex_struct::flag, dxf_file_struct::fp, dxf_vertex_struct::id_code, dxf_vertex_struct::layer, dxf_file_struct::line_number, dxf_vertex_struct::linetype, dxf_vertex_struct::linetype_scale, dxf_vertex_struct::paperspace, dxf_vertex_struct::polyface_mesh_vertex_index_1, dxf_vertex_struct::polyface_mesh_vertex_index_2, dxf_vertex_struct::polyface_mesh_vertex_index_3, dxf_vertex_struct::polyface_mesh_vertex_index_4, dxf_vertex_struct::start_width, dxf_vertex_struct::thickness, dxf_vertex_struct::visibility, dxf_vertex_struct::x0, dxf_vertex_struct::y0, and dxf_vertex_struct::z0.

Here is the call graph for this function:

int dxf_vertex_write ( DxfFile fp,
DxfVertex vertex 
)

Write DXF output to fp for a vertex entity.

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.

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.
Todo:
Put thickness in the correct order.
Todo:
We use a 3dPolylineVertex for now, it could have been a 2dVertex as well, in that case use:
fprintf (fp->fp, "100\nAcDb2dVertex\n");

Parameters:
fpDXF file pointer to an output file (or device).
vertexa pointer to the DXF VERTEX entity.

Definition at line 434 of file vertex.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_11, AutoCAD_13, AutoCAD_14, dxf_vertex_struct::bulge, dxf_vertex_struct::color, dxf_vertex_struct::curve_fit_tangent_direction, dxf_vertex_struct::dictionary_owner_hard, dxf_vertex_struct::dictionary_owner_soft, DXF_COLOR_BYLAYER, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, DXF_DEFAULT_LINETYPE, DXF_FLATLAND, DXF_PAPERSPACE, dxf_vertex_struct::elevation, dxf_vertex_struct::end_width, dxf_vertex_struct::flag, dxf_file_struct::fp, dxf_vertex_struct::id_code, dxf_vertex_struct::layer, dxf_vertex_struct::linetype, dxf_vertex_struct::linetype_scale, dxf_vertex_struct::paperspace, dxf_vertex_struct::polyface_mesh_vertex_index_1, dxf_vertex_struct::polyface_mesh_vertex_index_2, dxf_vertex_struct::polyface_mesh_vertex_index_3, dxf_vertex_struct::polyface_mesh_vertex_index_4, dxf_vertex_struct::start_width, dxf_vertex_struct::thickness, dxf_vertex_struct::visibility, dxf_vertex_struct::x0, dxf_vertex_struct::y0, and dxf_vertex_struct::z0.

Referenced by dxf_donut_write(), and dxf_polyline_write().

int dxf_vertex_free ( DxfVertex vertex)

Free the allocated memory for a VERTEX 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:
vertexa pointer to the DXF VERTEX entity.

Definition at line 617 of file vertex.c.

References _, dxf_vertex_struct::dictionary_owner_hard, dxf_vertex_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_vertex_struct::layer, dxf_vertex_struct::linetype, and dxf_vertex_struct::next.

Referenced by dxf_polyline_write(), and dxf_vertex_free_chain().

void dxf_vertex_free_chain ( DxfVertex vertices)

Free the allocated memory for a chain of DXF VERTEX entities and all their data fields.

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
verticesa pointer to the chain of DXF VERTEX entities.

Definition at line 665 of file vertex.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_vertex_free(), and dxf_vertex_struct::next.

Referenced by dxf_polyline_free().

Here is the call graph for this function: