CAD Exchanger SDK
Topological entities are used to define trimming of the geometrical entities (see B-Rep Geometry) and connectivity between the entities.
Some topological entities refer to geometrical entities (e.g. edge refers to curve and face refers to surface), whereas some only refer to child topological entities (e.g. wires refers to edges it consists of).
All topological entities subclass the ModelData_Shape class.
CAD Exchanger API follows the ISO 10303-42 specification and supports the shape types defined below. The shape type is returned returned by ModelData_Shape::Type() as ModelData_ShapeType enumeration.
The shape can be casted to a particular subclass type using the respective Cast() method defined in the subclass, for instance:
Each shape can have either forward or reversed orientation as returned by the Orientation() method. Meaning of orientation depends on the shape type:
A shape with the opposite orientation can be returned with the Reversed() method. A shape with a specified orientation can be returned with the Oriented() method. Both methods create a shallow copy of the original shape, which shares a subshape graph but has a distinct orientation flag.
Two shapes are considered equal if they share the same definition (i.e. geometry and subshape graph). Orientations are not required to be equal. The method IsSame() can be used to check this relationship. Obviously, the 'IsSame' relationship is less strict than 'IsEqual'.
The following code snippet demonstrates both relationships:
For example, a closed shell contains pairs of IsSame() edges but with opposite orientations.
To retrive direct children of a shape, ModelData_Shape::Iterator should be used as follows:
To retrive children of a particular type, ModelData_Shape::Iterator should be used by specifying a type of interest as follows:
When using the latter approach exploration is done traversing the graph of subshapes in a depth-first manner. Each subshape will be found as many times as it is registered in the parent subshape. For instance, a seam-edge will be encountered twice, with forward and reversed orientations.
The order of returned subshapes is deterministic and corresponds to the order in which the subshapes were added during construction.
Orientation of a returned subshape is product of own subshape orientation (stored inside a subshape) and of its parent. Thus, if the subshape and its parent both have the same orientation then the returned subshape will have forward orientation, if they have opposite orientations then the returned subshape will have reversed orientation.
When exploring nested subshapes the same rule applies at each level of the hierarchy:
Resulting_orientation = parent_orientation * subshape_orientation * subsubshape_orientation * ...
For instance, when exploring a forward face, which has a wire with reversed orientation, with an edge having forward orientation, exploring that edge will return an edge with reversed orientation.
Shapes can be stored in associative containers (such as std::unordered_map or std::unordered_set) as keys. Hash and equality functors required for such containers can be selected depending on desired behavior, whether the container must ensure uniquness defined in terms of equality or similarity relationships:
Refer to Equality and similarity relationships for relationship definitions.
The following code snippet demonstrates usage of both approaches:
Refer to Model Explorer.