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

group.c File Reference

Functions for a DXF group object (GROUP). More...

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

Go to the source code of this file.

Functions

DxfGroupdxf_group_new ()
 Allocate memory for a DxfGroup.
DxfGroupdxf_group_init (DxfGroup *group)
 Allocate memory and initialize data fields in a GROUP object.
DxfGroupdxf_group_read (DxfFile *fp, DxfGroup *group)
 Read data from a DXF file into a DXF GROUP object.
int dxf_group_write (DxfFile *fp, DxfGroup *group)
 Write DXF output to a file for a DXF GROUP object.
int dxf_group_free (DxfGroup *group)
 Free the allocated memory for a DXF GROUP and all it's data fields.
void dxf_group_free_chain (DxfGroup *groups)
 Free the allocated memory for a chain of DXF GROUP objects and all their data fields.
int dxf_group_get_id_code (DxfGroup *group)
 Get the ID code from a DXF GROUP object.
DxfGroupdxf_group_set_id_code (DxfGroup *group, int id_code)
 Set the ID code for a DXF GROUP object.
char * dxf_group_get_dictionary_owner_soft (DxfGroup *group)
 Get the soft pointer to the dictionary owner from a DXF GROUP object.
DxfGroupdxf_group_set_dictionary_owner_soft (DxfGroup *group, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF GROUP object.
char * dxf_group_get_dictionary_owner_hard (DxfGroup *group)
 Get the hard pointer to the dictionary owner from a DXF GROUP object.
DxfGroupdxf_group_set_dictionary_owner_hard (DxfGroup *group, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF GROUP object.
int dxf_group_get_unnamed_flag (DxfGroup *group)
 Get the unnamed flag value from a DXF GROUP object.
DxfGroupdxf_group_set_unnamed_flag (DxfGroup *group, int unnamed_flag)
 Set the unnamed flag value for a DXF GROUP object.
int dxf_group_get_selectability_flag (DxfGroup *group)
 Get the selectability flag value from a DXF GROUP object.
DxfGroupdxf_group_set_selectability_flag (DxfGroup *group, int selectability_flag)
 Set the selectability flag value for a DXF GROUP object.
char * dxf_group_get_description (DxfGroup *group)
 Get the description from a DXF GROUP object.
DxfGroupdxf_group_set_description (DxfGroup *group, char *description)
 Set the description for a DXF GROUP object.
char * dxf_group_get_handle_entity_in_group (DxfGroup *group)
 Get the handle of entity in group from a DXF GROUP object.
DxfGroupdxf_group_set_handle_entity_in_group (DxfGroup *group, char *handle_entity_in_group)
 Set the handle of entity in group for a DXF GROUP object.
DxfGroupdxf_group_get_next (DxfGroup *group)
 Get the pointer to the next GROUP entity from a DXF GROUP object.
DxfGroupdxf_group_set_next (DxfGroup *group, DxfGroup *next)
 Set the pointer to the next GROUP for a DXF GROUP object.
DxfGroupdxf_group_get_last (DxfGroup *group)
 Get the pointer to the last GROUP object from a linked list of DXF GROUP objects.

Detailed Description

Functions for a DXF group object (GROUP).

Author:
Copyright (C) 2015, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.
Since:
The GROUP object was introduced in DXF R13.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12 (backward compatibility).
According to DXF R13.
According to DXF R14.

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


Function Documentation

DxfGroup* dxf_group_new ( )

Allocate memory for a DxfGroup.

Fill the memory contents with zeros.

Definition at line 52 of file group.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_group_init(), and dxf_group_read().

DxfGroup* dxf_group_init ( DxfGroup group)

Allocate memory and initialize data fields in a GROUP object.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
groupDXF GROUP object.

Definition at line 90 of file group.c.

References _, dxf_group::description, dxf_group::dictionary_owner_hard, dxf_group::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_group_new(), dxf_group::handle_entity_in_group, dxf_group::id_code, dxf_group::next, dxf_group::selectability_flag, and dxf_group::unnamed_flag.

Referenced by dxf_group_read().

Here is the call graph for this function:

DxfGroup* dxf_group_read ( DxfFile fp,
DxfGroup group 
)

Read data from a DXF file into a DXF GROUP object.

The last line read from file contained the string "GROUP".
Now follows some data for the GROUP object, to be terminated with a " 0" string announcing the following object.
While parsing the DXF file store data in group.

Returns:
a pointer to group object.
Parameters:
fpDXF file pointer to an input file (or device).
groupDXF GROUP object.

Definition at line 140 of file group.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, dxf_group::description, dxf_group::dictionary_owner_hard, dxf_group::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_group_init(), dxf_group_new(), dxf_file_struct::filename, dxf_file_struct::fp, dxf_group::handle_entity_in_group, dxf_group::id_code, dxf_file_struct::line_number, dxf_group::selectability_flag, and dxf_group::unnamed_flag.

Here is the call graph for this function:

int dxf_group_write ( DxfFile fp,
DxfGroup group 
)

Write DXF output to a file for a DXF GROUP object.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.

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).
groupDXF Group object.

Definition at line 283 of file group.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_group::description, dxf_group::dictionary_owner_hard, dxf_group::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_file_struct::fp, dxf_group::handle_entity_in_group, dxf_group::id_code, dxf_group::selectability_flag, and dxf_group::unnamed_flag.

int dxf_group_free ( DxfGroup group)

Free the allocated memory for a DXF GROUP and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
groupPointer to the memory occupied by the DXF GROUP object.

Definition at line 394 of file group.c.

References _, dxf_group::description, dxf_group::dictionary_owner_hard, dxf_group::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_group::handle_entity_in_group, and dxf_group::next.

Referenced by dxf_group_free_chain().

void dxf_group_free_chain ( DxfGroup groups)

Free the allocated memory for a chain of DXF GROUP objects and all their data fields.

Parameters:
groupspointer to the chain of DXF GROUP objects.

Definition at line 437 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_group_free(), and dxf_group::next.

Here is the call graph for this function:

int dxf_group_get_id_code ( DxfGroup group)

Get the ID code from a DXF GROUP object.

Returns:
ID code.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 470 of file group.c.

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

DxfGroup* dxf_group_set_id_code ( DxfGroup group,
int  id_code 
)

Set the ID code for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
id_codeIdentification number for the entity.
This is to be an unique (sequential) number in the DXF file.

Definition at line 508 of file group.c.

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

char* dxf_group_get_dictionary_owner_soft ( DxfGroup group)

Get the soft pointer to the dictionary owner from a DXF GROUP object.

Returns:
soft pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 553 of file group.c.

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

DxfGroup* dxf_group_set_dictionary_owner_soft ( DxfGroup group,
char *  dictionary_owner_soft 
)

Set the pointer to the dictionary_owner_soft for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the entity.

Definition at line 592 of file group.c.

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

char* dxf_group_get_dictionary_owner_hard ( DxfGroup group)

Get the hard pointer to the dictionary owner from a DXF GROUP object.

Returns:
hard pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 636 of file group.c.

References _, dxf_group::dictionary_owner_hard, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

DxfGroup* dxf_group_set_dictionary_owner_hard ( DxfGroup group,
char *  dictionary_owner_hard 
)

Set the pointer to the dictionary_owner_hard for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the entity.

Definition at line 675 of file group.c.

References _, dxf_group::dictionary_owner_hard, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

int dxf_group_get_unnamed_flag ( DxfGroup group)

Get the unnamed flag value from a DXF GROUP object.

Returns:
unnamed flag.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 716 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::unnamed_flag.

DxfGroup* dxf_group_set_unnamed_flag ( DxfGroup group,
int  unnamed_flag 
)

Set the unnamed flag value for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
unnamed_flagthe unnamed flag value to be set for the entity.

Definition at line 759 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::unnamed_flag.

int dxf_group_get_selectability_flag ( DxfGroup group)

Get the selectability flag value from a DXF GROUP object.

Returns:
selectability flag.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 798 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::selectability_flag.

DxfGroup* dxf_group_set_selectability_flag ( DxfGroup group,
int  selectability_flag 
)

Set the selectability flag value for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
selectability_flagthe selectability flag value to be set for the entity.

Definition at line 841 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::selectability_flag.

char* dxf_group_get_description ( DxfGroup group)

Get the description from a DXF GROUP object.

Returns:
description when sucessful, NULL when an error occurred.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 886 of file group.c.

References _, dxf_group::description, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

DxfGroup* dxf_group_set_description ( DxfGroup group,
char *  description 
)

Set the description for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
descriptiona string containing the description for the object.

Definition at line 924 of file group.c.

References _, dxf_group::description, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

char* dxf_group_get_handle_entity_in_group ( DxfGroup group)

Get the handle of entity in group from a DXF GROUP object.

Returns:
Handle of entity in group when sucessful, NULL when an error occurred.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 965 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::handle_entity_in_group.

DxfGroup* dxf_group_set_handle_entity_in_group ( DxfGroup group,
char *  handle_entity_in_group 
)

Set the handle of entity in group for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
handle_entity_in_groupa string containing the handle of entity in group for the object.

Definition at line 1003 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::handle_entity_in_group.

DxfGroup* dxf_group_get_next ( DxfGroup group)

Get the pointer to the next GROUP entity from a DXF GROUP object.

Returns:
pointer to the next GROUP object.
Warning:
No checks are performed on the returned pointer.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 1047 of file group.c.

References _, DEBUG, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::next.

DxfGroup* dxf_group_set_next ( DxfGroup group,
DxfGroup next 
)

Set the pointer to the next GROUP for a DXF GROUP object.

Parameters:
groupa pointer to a DXF GROUP object.
nexta pointer to the next GROUP for the object.

Definition at line 1086 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::next.

DxfGroup* dxf_group_get_last ( DxfGroup group)

Get the pointer to the last GROUP object from a linked list of DXF GROUP objects.

Returns:
pointer to the last GROUP object.
Warning:
No checks are performed on the returned pointer.
Parameters:
groupa pointer to a DXF GROUP object.

Definition at line 1129 of file group.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_group::next.