Softimage SDK Programmer's Guide > Working with the SDK > Modeling >

# Changing the Topology (Adding and Removing Components)

The tables below provides a list of some of the more common commands and methods that add or remove components:

Geometry | Native Softimage Commands | Object Model
--- | --- | ---
Curves | ApplyTopoOp SIAddPointOnCurve SIAddPointOnCurveAtEnd SIAddPointOnCurveAtStart SIDeletePointOnCurve Note Many topology-changing commands are handled by using ApplyTopoOp and specifying one of the many operators, such as InsertNurbsCrvKnot, RemoveNurbsCrvKnot, CrvOpenClose, etc. | AddElement (SubComponent) RemoveElement (SubComponent) Note In the object model, all subelements can be added and removed using these methods except isolines and isopoints (because they cannot be indexed). However, SubComponents are only available through a Cluster.
Polygon | AddEdge ApplyTopoOp DuplicateMeshComponent SplitEdge SplitPolygon Note Many topology-changing commands are handled by using ApplyTopoOp and specifying one of the many operators, such as DeleteComponent, DiceObject, WeldPoints, etc.
Nurbs | ApplyTopoOp Note Most topology-changing commands are handled by using ApplyTopoOp and specifying one of the many operators, such as InsertSrfKnot, RemoveSrfKnot, SrfOpenClose, etc.

Note

For examples of topology changes inside clusters, see Example: Add points to the cluster and Example: Remove points from the cluster.

## Coping with Topology Changes

What's the difference between the indicies of the polygons and their ID's? How can I show the ID's of those polygon in a list? The short answer is that you cannot, because the mapping of indices is not exposed. However, you can create a workaround with user data properties.

Important

By design, before and after applying a topology operator, mesh components are numbered 0..N-1, with all IDs used.

If you delete geometry components, the topology operation essentially re-indexes all the components in order to respect the rule above. For example, if you have a four-polygon grid (with indices 0,1,2,3) and you delete the polygons at index 1 and 2, the result is a two polygon grid (with indices 0,1). In other words, using poly[4] results in an error, since poly[1] is the highest valid index for that grid.

Topology operators can change mesh components as they need, by doing internal operations such as:

- Renaming index A to B

- Swapping indices A and B

- Renaming any index among [A,B,C,D...] to A; for example, dissolving (reducing several vertices to a single vertex)

- Replacing A with [A,B,C,D...]; for example, splitting a single polygon into many (polygon A becomes polygons A,B,C,D)

Then the topolology update mechanism ensures that all cluster elements are processed in the same way. As you see in these operations, the mapping is not necessarily 1 to 1.

If you are trying to update some properties or some data in the same way as the topology operators are updating the clusters, the only correct way of doing this is to put your data in a cluster property under the cluster (for example, using a user data map). Using cluster properties is actually a way of extracting 1 to 1 mapping. However, it is not always sufficient since there are also situations involving N-to-1 and 1-to-N mapping.

If you want to get the 1 to 1 mapping (for example, to handle the aftermath of deleting a polygon), a safe way of doing this is to create a user data property under the cluster, with the same content as the cluster:

    Cluster A = {1,3,4}

    Property under cluster A = {1,3,4}

Then, if a topo operation deletes element 3 and renames element 4 to 3, the resulting data will be:

    Cluster A = {1,3}

    Prop under cluster A = {1,4}