SUBSYSTEM OVERVIEW

IGES Interface (IGES) Subsystem

The IGES subsystem is the top level subsystem in the IGES interface. The IGES subsystem provides IGES schema dependent functions for accessing IGES data stored in a model. The reader should be familiar with the mda and ddf subsystems (see mda_intro and ddf_intro) before reading this manual page.

GENERAL CONCEPTS

The IGES interface consists of the IGES DDF and several subsystems (all four characters with the first being "i"). The function iges_Initialize must be called once before any other IGES interface function. The call to iges_Initialize must follow the pdx_Initialize call. Once processing is complete, the function iges_Terminate should be called prior to calling pdx_Terminate.

CREATING AN IGES MODEL

To create an IGES model, the following code sequence is used:

#include "ddf_Interface.h"
#include "mda_Interface.h"
#include "iges_Interface.h"
     
MDA_MODEL_INFO m_info;
int model;
        .
pdx_Initialize (PDX_NOOPT);
iges_Initialize (IGES_NOOPT);
        .
mda_GetModelDefaults (MDA_NOOPT, &m_info);
iges_InitModelInfo (IGES_NOOPT, &m_info);
        .
/*  Other m_info fields set  */ 
        .
mda_AllocateModel (MDA_NOOPT, &m_info, &model);

The model is now ready to have IGES entities added. The model can be populated with the contents of an ASCII IGES file by calling mda_ParseFile. The contents of a model can be written to an ASCII IGES file by calling mda_FormatFile. The mda_intro manual page describes how additional entities are added to the model.

START AND GLOBAL SECTIONS

The start and global sections are stored as entities in the model. They are automatically created when the model is allocated and will always be locked in memory. Their structure pointers are retrieved using the functions iges_Start and iges_Global. They may then be dereferenced just like any other entity. The application can modify them as appropriate using the mda functions. To make generating and modifying start section information easier, a set of functions are provided to insert, append, return, and delete start section text. See the man pages for iges_GetStartLine, iges_AppendStartLine, iges_InsertStartLine, iges_DeleteStartLine, and iges_CycleStartLine. To initialize the global section to default values use iges_InitGlobalSection. This function will free any memory previously allocated for the global section entity before assigning the default values.

Several utilities are also provided to make generation of global section fields easier. The function iges_GetUnitString takes an integer units flag and returns the corresponding units string. The function iges_GetDateTime returns the current date and time in standard IGES format.

DE NUMBERS

Since the database pointers resulting from a parsed ASCII IGES file do not correspond to the original DE numbers, a function called iges_GetDbptr can be used to map a DE number to a database pointer. To map a database pointer back to a DE number, the function iges_GetDE can be used.

DE, PROPERTY, AND ASSOCIATIVITY STRUCTURES

Each entity has a DE, property, and associativity structure defined in it. These structures are declared as T_IGESDE, T_PROPS, and T_ASSOCS respectively. An application can obtain these structures for any entity using the function iges_GetEntityStructs. This will return all three structure pointers for a given entity. Alternatively, iges_GetEntityDEStruct will return just the DE structure pointer. The functions iges_GetEntityPropStruct and iges_GetEntityAssocStruct return just the property and associativity structures. Properties can be added to an entity using the iges_AddPropPtr function.

The DE structure of any entity can be set using the iges_SetEntityDEStruct function. The values are set based on the current DE stack which is initialized to defaults. The DE stack can be manipulated with the functions iges_AddToDEStack and iges_RemoveFromDEStack.

BACKPOINTERS

The MDA subsystem provides the capability of storing backpointers to referencing entities. The ASCII IGES file parser will automatically generate backpointer information if the backptrs field in the model_info structure is set to 1 before calling mda_AllocateModel. Note that the backpointers supported by the database have no effect on the associativity backpointers required by some IGES entity types, these must be explicitly set by the application. All of the functions in the IGES interface which set, modify, or delete pointers will maintain backpointer information if the backptrs field is set.

ATTRIBUTES

The iges attributes are maintained with the entity attribute manager (eam). The iges attribute structure (IGES_ATTR) contains a DE parameter mask and the corresponding attributes affected by the hierarchy (line font, view, entity level, blank status, line weight, color number). The mask is used in conjunction with the attribute values defined in the IGES ddf (A_FONT, A_VIEW, A_LEVEL, A_BLANKING, A_WEIGHT, A_COLOR) to determine which attributes are active. The attribute structure also contains a transformation (IMTH_MATRIX). The function iges_InitAttrInfo is used to set the IGES default parameters in the EAM_INFO structure which is passed to the eam_AllocateAttrStack function. The structure contains the size of the attributes, default attributes and the function to implicitly invoke by the attribute manager when a new level is added to the stack or when the attributes are applied.

When a level is added several operations are performed. First, if the hierarchy on the specified entity is 0, the applicable DE attributes as specified in the IGES ddf are set and the mask is set accordingly. If the hierarchy is 1, the attribute mask is set to zero. If the hierarchy is 2, the property pointers are cycled searching for the 406:10. If found, the DE attributes of the 406:10 as defined in the parameter data are set and the mask set accordingly. Next, if the specified entity is a structure entity (116,125,132,408,412,414,420) the translation is put into the current matrix. Next, if the specified entity has a matrix, the matrix is concatenated with the current matrix. Note, the option IGES_NOMATRIX may be specified to prevent the concatenation operation of the entity matrix. Next, if the the specified entity is a structure entity (408,412,420) the scale is put into the current matrix. Finally, the attribute structure is added to the stack and becomes current.

When the attributes are applied to the specified entity similar operations are performed. First, a check is made to see if the entity is a 406:31 to get the hierarchy attributes from the parent regardless of the hierarchy. Otherwise, if the current attributes as specified by the mask do not apply, the corresponding DE attributes of the specified entity are set (Note: if the entity is a 212 the font is set to 1 regradless of the hierarchy). Next, if the specified entity has a matrix, it is concatenated with the current matrix. Again, the option IGES_NOMATRIX may be specified to prevent the concatenation operation of the entity matrix. Finally, the attribute structure is returned.

The following code sequence illustrates the use of the entity attribute manager:

#include "mda_Interface.h"
#include "eam_Interface.h"
#include "iges_Interface.h"
EAM_INFO iges_info;
EAM_STACK *iges_stack;
IGES_ATTR *iges_attr;
MDA_PTR db_ptr;
T_IGES_102_0 *composite;
void *entity;
int ides;
   
/* initialize the info structure */
iges_InitAttrInfo (IGES_NOOPT, &iges_info);
   
/* allocate the attribute stack */
iges_stack = eam_AllocateAttrStack (EAM_NOOPT, &iges_info);
   
/* push the attributes of the composite curve onto the stack */
   
mda_LockEntity (MDA_NOOPT,db_ptr,&composite);
eam_AddToAttrStack (EAM_NOOPT,iges_stack,composite);
/* apply the attributes to each entity in the composite curve */
for (ides=0;ides<composite->ndes;ides++);
{
   mda_LockEntity (MDA_NOOPT,composite->des[ides],&entity);
   iges_attr = eam_GetAppliedAttr (EAM_NOOPT,iges_stack,entity);
   /* set attributes */
   if (iges_attr->mask & A_FONT) app_SetFont (iges_attr->igesde.font);
   if (iges_attr->mask & A_VIEW) app_SetView (iges_attr->igesde.view);
   if (iges_attr->mask & A_LEVEL) app_SetLevel (iges_attr->igesde.level);
   if (iges_attr->mask & A_BLANKING) app_SetBlanking  (iges_attr->igesde.blanking);
   if (iges_attr->mask & A_WEIGHT) app_SetWeight (iges_attr->igesde.weight);
   if (iges_attr->mask & A_COLOR) app_SetColor (iges_attr->igesde.color);
   /* apply matrix */
   app_ApplyMatrix (iges_attr->matrix,entity);      
   free (iges_attr);
}

This illustration allocates an entity attribute stack and then adds a level defined by the specified entity. As a result, the iges attribute structure will contain the active DE parameters, a concatenated matrix at the current level. See the entity attribute manager subsystem (EAM) for more information on manipulating the stack.

LOG

Five sections are provided for log processing. Section one contains the title, file name, date, and time. Section two contains the start section, global section, entity count, and drawing/view summary. Section three contains the error count, error summary, and elapsed time. Section four contains the DE attribute summaries for color, level, weight, and font. Section five contains a type form summary of the entity validation. A variable if type IEVM_VAL_RESULTS containing a pointer to entity validation results is required as an argument. This should only be used if entity validation has been performed, ievm_ValidateModel(). These calls must be made before the mda_FreeModel is called as they make mda calls. The mpm_IssueMessage function may be invoked to output the three sections as follows:

#include "mda_Interface.h"
#include "mpm_Interface.h"
#include "ifmt_Interface.h"
#include "ievm_Interface.h"
int model;
char logfile[80],igesfile[80],title[80];
IEVM_VAL_RESULTS *val_results=NULL;
mpm_OpenLog (MPM_NOOPT,logfile);
mpm_SetOption (MPM_NOSTD);
mpm_IssueMessage (MPM_NOOPT,IFMT_SECTION1,igesfile,title);
mda_ParseFile (MDA_NOOPT, model, igesfile, NULL);
mpm_IssueMessage (MPM_NOOPT,IFMT_SECTION2);
mpm_IssueMessage (MPM_NOOPT,IFMT_SECTION4,IFMT_ATTRCOLOR,IFMT_ATTRLEVEL,
                  IFMT_ATTRWEIGHT,IFMT_ATTRFONT,IFMT_ATTRVIEW);
ievm_ValidateModel(IEVM_STORE_ERRS,model,&val_results);
mpm_IssueMessage (MPM_NOOPT,IFMT_SECTION5,val_results);
ievm_FreeResults(IEVM_NOOPT,model,val_results);
mpm_IssueMessage (MPM_NOOPT,IFMT_SECTION3);
mpm_CLoseLog (MPM_NOOPT);

DELETING ENTITIES

IGES entities can be intelligently deleted using the iges_DeleteEntity function. This function will delete the target entity, its children and fix any references by the parents of the target entity. Please refer to the iges_DeleteEntity manual page for more information.

IGES CONSTANTS

The include file iges_Interface.h has #defines for most of the constants used in working with IGES. These defines include the following:

  Line font patterns:
      IGES_NOPATTERN
      IGES_SOLIDLINE
      IGES_DASHED
      IGES_PHANTOM
      IGES_CENTERLINE
      IGES_DOTTED
  Colors:
      IGES_NOCOLOR
      IGES_BLACK
      IGES_RED
      IGES_GREEN
      IGES_BLUE
      IGES_YELLOW
      IGES_MAGENTA
      IGES_CYAN
      IGES_WHITE
  Units:
      IGES_INCHES
      IGES_MILLIMETERS
      IGES_UNITNAME
      IGES_FEET
      IGES_MILES
      IGES_METERS
      IGES_KILOMETERS
      IGES_MILS
      IGES_MICRONS
      IGES_CENTIMETERS
      IGES_MICROINCHES
  Blanking status:
      IGES_VISIBLE
      IGES_BLANK
  Subordinance status:
      IGES_INDEPENDENT
      IGES_PHYSICAL
      IGES_LOGICAL
      IGES_PHYSICAL_AND_LOGICAL
  Entity use status:
      IGES_GEOMETRY
      IGES_ANNOTATION
      IGES_DEFINITION
      IGES_OTHER_USAGE
      IGES_LOGICAL_POSITIONAL
      IGES_2D_PARAMETRIC
      IGES_CONSTRUCTION
  Entity hierarchy:
      IGES_GLOBAL_TOP_DOWN
      IGES_GLOBAL_DEFER
      IGES_USE_HIERARCHY_PROP

TOLERANCES

The tolerances used by the IGES subsystem can be accessed through the mda_SetTol, mda_SetTol2, mda_GetTol, and mda_GetTol2 functions. The following are the tolerance names, descriptions and default values used by the IGES subsystem:

Tolerance Name Description Default Value
EPSILON The smallest differences between 1.0e-8
two floating point numbers before
they are considered identical
MAX_COORD_VALUE The largest value a coordinate default
can be before it is considered 1.0e6
invalid
ANNOT_FACTOR A factor to multiply the model 1.0e3
tolerances by to obtain the
annotation tolerances
MODEL_LINEAR_APPROX_TOL Tolerance used for performing 0.001
linear approximation on an
IGES model. Note, setting this
tolerance only effects the IGES
subsystem.

PROCESSING SOLIDS

In order to process IGES SOLID entities (type 186), the function iges_ConvertToSolids must be called. This function converts the topological entities which make up an IGES SOLID (186,514,510,508,504,502) into more workable forms and stores them in the model as ITI_SOLID, ITI_SHELL, ITI_FACE, ITI_LOOP, ITI_EDGE and ITI_VERTEX entities. As a result of the conversion method used, any topological entities in the model which are not referenced by a SOLID or another topological entity will not be converted.

These ITI_* entities can then be converted back to their IGES counterparts for output purposes by calling the function iges_ConvertFromSolids. One edge list (504) and one vertex list (502) will be created for the entire model unless IGES_EACHLIST is input as an option to iges_ConvertFromSolids. This option will cause a separate edge and vertex list to be created for each solid in the model. As was the case during input, any unreferenced topological entities (these could be caused by the deletion of a parent entity) will not be converted.

The backpointer capability should be enabled (see BACKPOINTERS section above) when processing solids. By using backpointers, any references to the ITI_* entities by IGES entities will be automatically maintained. The only ITI_* entity which has DE, ASSOCS and PROPS information is the SOLID and this information is copied from the IGES SOLID (186) on input and to the IGES SOLID on output.

IMPLEMENTOR DEFINED PROPERTY

Since all implementor defined properties are specified by IGES_406_IDP, there are functions to access the form explicitly. One function to set the form (iges_SetIDP) and another to obtain the form (iges_GetIDP). These functions should be used exclusively when processing all implementor defined property forms.

IMPLEMENTOR DEFINED ENTITY

Since all implementor defined entities are specified by IGES_UNDEFINED, there are functions to access the type and form explicitly. One function to set the type and form (iges_SetIDE) and another to obtain the type and form (iges_GetIDE). These functions should be used exclusively when processing all implementor defined entity types and forms.

ENTITY MAPPING

A high level interface for approximation, conversion, and structure decomposition exists in iges_MapEntity. This function works in conjunction with an application's dispatcher to map entities which the application does not directly support to entities which it does. See the iges_MapEntity man pages for details.

The imap subsystem provides mappings for conversion between IGES and GDX that can be used with the map entity framework.