Synopsis
PDX_MSGT iges_DeleteEntity(long option, MDA_PTR db_ptr, OLM_LIST **problem_parents, OLM_LIST **problem_child, MDA_ENT_FUNC *func)
Purpose
Delete an IGES entity and fix pointer references
Description
This routine is used to delete an IGES entity and its children. The target entity and its children are recursively traversed until all applicable children of the target entity are deleted.
The following rules apply to deleting children:
If a child has only one parent and it is physically subordinate to that parent, it is deleted. If a child has only one parent and it is logically subordinate to that parent, the child is made independent
If a child has more than one parent, it is not deleted unless it is both logically and physically (LANDP) subordinate to its parents. In this case, an attempt will be made to resolve the situation (this is not supported yet).
For the LANDP child mentioned above, this routine will attempt to resolve the case on a special case basis. The option IGES_FIX_CHILDREN indicates that the deletion code should attempt to fix the LANDP child. If the situation cannot be resolved, the child entity is left intact and its database pointer is added to the problem-child list. If the IGES_FIX_CHILDREN option is not set and a LANDP child is encountered, no interpretation is performed and the LANDP child is simply added to the problem-child list. The parents of the target entity are also processed to clean up any references to the deleted entity. Each parent reference to the target entity is either NULLed or removed, depending on the parent type. The following rules apply to processing of parent entities:
If the parent of the target entity is one of the following types, the pointer from the parent to the child is simply removed from the parent entity. These special types of parents include 308:0, 320:0, 404:0, 404:1, 402:1, 402:7, 402:14, 402:15, 402:16.
If the target entity is referenced from the parent's DE section, the pointer in the parent's DE section is defaulted. If the pointer was a member or a union, the union type is changed (to the integer type) and the field value is defaulted.
If the target entity is referenced by the parent's ASSOCS or PROPS section, the pointer from the parent to the target entity is simply removed from the ASSOCS or PROPS section as necessary.
If the parent-child relationship does not fall into one of the above categories, the parent entity is traversed and each reference to the child is NULLed. Because this may render the parent entity invalid, it is added to the list of problem-parents. It is up to the application to validate each problem- parent on an entity-to-entity basis.
The IGES_NO_FORCE switch is used to suppress the NULLing of pointers from the parent to the child in a problem parent entity. If this option is set and the target entity has a problem parent, the deletion process is aborted. It should be noted that this option may slow down the deletion process because this routine will have to examine each parent twice: once to make sure that there are no problem parents and a second time to actually remove the references from the parent to the target entity.
The default for this function is to NULL the pointer from the parent entity to the target entity when a problem parent is encountered. In this case, the parent entity will be added to the list of problem-parents.
This routine allows the application to pass in a user-defined function which will determine if a child entity should be deleted or not. Before any child of the target entity is scheduled for delete, this user-defined function is invoked. If the function returns a zero (FALSE) value, the child entity is not deleted. For a non-zero (TRUE) return, the child entity will be recursively traversed and deleted (if it falls into one of the categories mentioned above). A NULL can be passed in as the user-defined function. In this case, each child is traversed and deleted as if the function always returned a TRUE. In order for this function to work properly, backpointer information must be turned on for the current model.
Input
option
IGES_NO_FORCE
Suppress NULLing of pointers from parent to child in a problem parent entity. If the target entity has a problem parent, the deletion process is aborted.
IGES_FIX_CHILDREN
For LANDP children, interpret the case and attempt to fix the relationship.
RESERVE_TARGET
Delete the target entity but use the MDA_RESERVE option. (See mda_DeleteEntity)
db_ptr
Database pointer of entity to be deleted (target entity).
func
User function to determine whether or not a child entity should be deleted. Before a child is scheduled for delete, this function is invoked. If this function returns a zero (FALSE) value, the child entity is NOT deleted. For a non-zero (TRUE) return, the current child is scheduled for delete (if it conforms to the child-deletion rules mentioned above) and entity traversal continues into the child. A NULL can be passed in, in which case, each child is deleted as if the function always returned a TRUE.
Output
problem_parents
This list is created if any problem parents are encountered while removing the references from the parents to the target entity. If no problem-parents are found, this argument is set to NULL. If a problem-parents is found, the routine will create and load this list. It is up to the application to process and delete it using the olm_DeleteList function.
problem_child
This list is created if any problem children are encountered during the recursive delete. If no problem-children are found, this argument is set to NULL. If a problem-child is found, the routine will create and load this list. It is up to the application to process and delete it using the olm_DeleteList function.
Return
IGES error code