TopExp
OCCT package TopExp: TopExp, TopExp_Explorer.
TopExp
This package provides basic tools to explore the topological data structures.
- Explorer: A tool to find all sub-shapes of a given type. e.g. all faces of a solid.
- Package methods to map sub-shapes of a shape.
Level : Public All methods of all classes will be public.
Constructors(1)
Static methods(10)
- MapShapes(S: TopoDS_Shape, T: TopAbs_ShapeEnum, M: NCollection_IndexedMap_TopoDS_Shape_TopTools_ShapeMapHasher): void
Tool to explore a topological data structure. Stores in the map <M> all the sub-shapes of of type <T>.
Warning: The map is not cleared at first.Parameters (3)STM—Mutated in place; read the updated value from this argument after the call.
- MapShapes(S: TopoDS_Shape, M: NCollection_IndexedMap_TopoDS_Shape_TopTools_ShapeMapHasher, cumOri: boolean, cumLoc: boolean): void
Stores in the map <M> all the sub-shapes of .
- If cumOri is true, the function composes all sub-shapes with the orientation of S.
- If cumLoc is true, the function multiplies all sub-shapes by the location of S, i.e. it applies to each sub-shape the transformation that is associated with S.
Parameters (4)SM—Mutated in place; read the updated value from this argument after the call.cumOricumLoc
- MapShapes(S: TopoDS_Shape, M: NCollection_Map_TopoDS_Shape_TopTools_ShapeMapHasher, cumOri: boolean, cumLoc: boolean): void
Stores in the map <M> all the sub-shapes of .
- If cumOri is true, the function composes all sub-shapes with the orientation of S.
- If cumLoc is true, the function multiplies all sub-shapes by the location of S, i.e. it applies to each sub-shape the transformation that is associated with S.
Parameters (4)SM—Mutated in place; read the updated value from this argument after the call.cumOricumLoc
- MapShapesAndAncestors(S: TopoDS_Shape, TS: TopAbs_ShapeEnum, TA: TopAbs_ShapeEnum, M: NCollection_IndexedDataMap_TopoDS_Shape_NCollection_List_TopoDS_Shape_TopTools_ShapeMapHasher): void
Stores in the map <M> all the subshape of of type <TS> for each one append to the list all the ancestors of type <TA>. For example map all the edges and bind the list of faces. Warning: The map is not cleared at first.
Parameters (4)STSTAM—Mutated in place; read the updated value from this argument after the call.
- MapShapesAndUniqueAncestors(S: TopoDS_Shape, TS: TopAbs_ShapeEnum, TA: TopAbs_ShapeEnum, M: NCollection_IndexedDataMap_TopoDS_Shape_NCollection_List_TopoDS_Shape_TopTools_ShapeMapHasher, useOrientation: boolean): void
Stores in the map <M> all the subshape of of type <TS> for each one append to the list all unique ancestors of type <TA>. For example map all the edges and bind the list of faces. useOrientation = True : taking account the ancestor orientation Warning: The map is not cleared at first.
Parameters (5)STSTAM—Mutated in place; read the updated value from this argument after the call.useOrientation
- FirstVertex(E: TopoDS_Edge, CumOri?: boolean): TopoDS_Vertex
Returns the Vertex of orientation FORWARD in E. If there is none returns a Null Shape. CumOri = True : taking account the edge orientation.
Parameters (2)ECumOri
- LastVertex(E: TopoDS_Edge, CumOri?: boolean): TopoDS_Vertex
Returns the Vertex of orientation REVERSED in E. If there is none returns a Null Shape. CumOri = True : taking account the edge orientation.
Parameters (2)ECumOri
- Vertices(E: TopoDS_Edge, Vfirst: TopoDS_Vertex, Vlast: TopoDS_Vertex, CumOri: boolean): void
Returns in Vfirst, Vlast the FORWARD and REVERSED vertices of the edge <E>. May be null shapes. CumOri = True : taking account the edge orientation.
Parameters (4)EVfirst—Mutated in place; read the updated value from this argument after the call.Vlast—Mutated in place; read the updated value from this argument after the call.CumOri
- Vertices(W: TopoDS_Wire, Vfirst: TopoDS_Vertex, Vlast: TopoDS_Vertex): void
Returns in Vfirst, Vlast the first and last vertices of the open wire <W>. May be null shapes. if <W> is closed Vfirst and Vlast are a same vertex on <W>. if <W> is no manifold. VFirst and VLast are null shapes.
Parameters (3)WVfirst—Mutated in place; read the updated value from this argument after the call.Vlast—Mutated in place; read the updated value from this argument after the call.
- CommonVertex(E1: TopoDS_Edge, E2: TopoDS_Edge, V: TopoDS_Vertex): boolean
Finds the vertex <V> common to the two edges <E1,E2>, returns True if this vertex exists.
Warning: <V> has sense only if the value <True> is returnedParameters (3)E1E2V—Mutated in place; read the updated value from this argument after the call.
TopExp_Explorer
An Explorer is a Tool to visit a Topological Data Structure from the TopoDS package.
An Explorer is built with:
- The Shape to explore.
- The type of Shapes to find: e.g VERTEX, EDGE. This type cannot be SHAPE.
- The type of Shapes to avoid. e.g SHELL, EDGE. By default this type is SHAPE which means no restriction on the exploration.
The Explorer visits all the structure to find shapes of the requested type which are not contained in the type to avoid.
Example to find all the Faces in the Shape S :
TopExp_ExplorerEx; for (Ex.Init(S,TopAbs_FACE); Ex.More(); Ex.Next()) { ProcessFace(Ex.Current()); }
// an other wayTopExp_ExplorerEx(S,TopAbs_FACE); while (Ex.More()) { ProcessFace(Ex.Current()); Ex.Next(); }
To find all the vertices which are not in an edge :
for (Ex.Init(S,TopAbs_VERTEX,TopAbs_EDGE); ...)
To find all the faces in a SHELL, then all the faces not in a SHELL :
TopExp_ExplorerEx1, Ex2;
for (Ex1.Init(S,TopAbs_SHELL),...) { // visit all shells for (Ex2.Init(Ex1.Current(),TopAbs_FACE),...) { // visit all the faces of the current shell } }
for (Ex1.Init(S,TopAbs_FACE,TopAbs_SHELL),...) { // visit all faces not in a shell }
If the type to avoid is the same or is less complex than the type to find it has no effect.
For example searching edges not in a vertex does not make a difference.
Constructors(2)
Creates an empty explorer, becomes useful after Init.
- constructor(S: TopoDS_Shape, ToFind: TopAbs_ShapeEnum, ToAvoid?: TopAbs_ShapeEnum): TopExp_Explorer
Creates an Explorer on the Shape .
<ToFind> is the type of shapes to search. TopAbs_VERTEX, TopAbs_EDGE, ...
<ToAvoid> is the type of shape to skip in the exploration. If <ToAvoid> is equal or less complex than <ToFind> or if <ToAVoid> is SHAPE it has no effect on the exploration.Parameters (3)SToFindToAvoid
Instance methods(10)
- Init(S: TopoDS_Shape, ToFind: TopAbs_ShapeEnum, ToAvoid?: TopAbs_ShapeEnum): void
Resets this explorer on the shape S. It is initialized to search the shape S, for shapes of type ToFind, that are not part of a shape ToAvoid. If the shape ToAvoid is equal to TopAbs_SHAPE, or if it is the same as, or less complex than, the shape ToFind it has no effect on the search.
Parameters (3)SToFindToAvoid
- More(): boolean
Returns True if there are more shapes in the exploration.
- Next(): void
Moves to the next Shape in the exploration.
Returns the current shape in the exploration.
Returns the current shape in the exploration.
- ReInit(): void
Reinitialize the exploration with the original arguments.
Return explored shape.
- Depth(): number
Returns the current depth of the exploration. 0 is the shape to explore itself.
- Clear(): void
Clears the content of the explorer.
Returns a sentinel marking the end of iteration.