Deleting a PRC Tree
Any entity created with a Create function returns an entity handle that corresponds to some amount of memory in your system. When your work is done with this entity, you may want to release it’s associated memory by deleting it.
Deleting an entity is done differently according to whether it is already attached to another entity or not.
An entity is attached to another when is has a parent entity. For example:
A3DAsmModelFileis attached to it.
A3DAsmProductOccurrencecontains a protoype, this prototype is attached to it.
Attached/Detached is simply a different way to express wether an entity is part of a PRC tree or not.
Deleting an Attached Entity
If an entity is part of a PRC tree it _will_ be implicitly deleted upon the suppression of the model file using
Thus, you don’t have to worry about specifcally deleting each entities inside a model file.
// Delete a model file and recursively all its children: A3DStatus result = A3DAsmModelFileDelete(model_file); assert(result == A3D_SUCCESS);
All the handles of the deleted model file and its children will be invalidated.
Deleting a Detached Entity
To delete any entity you didn’t attach to any parent, call
A3DAsmModelFileDelete(), it will delete all the child entities as well:
// Delete an entity and recursively all its children: A3DStatus result = A3DEntityDelete(entity); assert(result == A3D_SUCCESS);
All the handles of the deleted entity and its children will be invalidated.
Some entity types require a specific function for deletion. Please see: