Deletes an element from a topology.
int
tpm_editdelelem(
ade_id tpm_id,
ade_id elem_id,
int delobj);
Returns RTNORM or an error code.
tpm_id | The topology ID. |
elem_id | The ID of the desired element. |
delobj | Delete status, either 0 (deletes the object from the topology only) or non-zero (deletes the object from the drawing also). |
The following example deletes from memory and erases all the links of a network topology and counts the number of successful deletions.
void Delete_links() { int indx = 0; // Element index int dindx = 0; // Deleted element count long qty = 0; ade_id tpm_id = ADE_NULLID; ade_id elm_id = ADE_NULLID; int result = 0; // load or build a network topology here // and also use tpm_acopen to assign a tpm_id for the topology // get the number of links tpm_elemqty (tpm_id, 2, &qty;); // delete all of the topology links for ( ; indx < qty ; ) { // get the links ID elm_id = tpm_elemid(tpm_id, 2, indx); if ( elm_id == ADE_NULLID ) { indx++; ads_printf("\nUnable to obtain an element ID."); } else { // delete element and erase object result = tpm_editdelelem(tpm_id, elm_id, 1); if ( result == RTNORM ) dindx++; else indx++; } } } // delete_links
Notes and Warnings
- This function does not erase corresponding entities in the drawing unless the delobj argument is set to something other than 0.
- Deleting an element can cause other deletions.
- If you delete a node, you delete any link or polygon that contains it.
- If you delete a link, you delete only the nodes belonging to that link. If the link belongs to one polygon only, you delete the polygon. If the link is shared by two polygons, you merge the polygons.
- If you delete a polygon, you delete any node or link belonging to that polygon only.