Topology Module
Shape representation and topological operations.
LightOcct::LShape
Light OCCT wrapper for TopoDS_Shape with enum + Handle pattern.
Provides type-safe topology storage using OCCT TopoDS_Shape internally. Follows Light OCCT architectural patterns: Enum + Handle pattern for type-safe storage POD structures for cross-language data exchange Wrapper methods using only Light OCCT types No OCCT types exposed in public interface Shape hierarchy (complex to simple): COMPOUND: Group of any shapes COMPSOLID: Connected solids SOLID: 3D bounded region SHELL: Connected faces FACE: Bounded surface WIRE: Connected edges EDGE: Bounded curve VERTEX: Point
#include <light-occt/topology/LShape.hxx>Quick Reference
Fields: myType
Factory Methods: CreateVertex(), CreateEdge(), CreateEdge(), CreateWire(), CreateFace(), CreateFace(), CreateFaceFromWire(), CreateFaceFromWires(), CreateTriangularFace(), CreateRectangularFace(), CreatePolygonalFace(), CreateFaceFromTriangulation(), CreateEdgeFromPoints(), CreateEdgeFromVertices(), CreatePolylineEdge(), CreateArcEdge(), CreateArcEdgeThrough3Points(), CreateWireFromEdges(), CreateRectangularWire(), CreatePolygonalWire(), CreateShell(), CreateSolid(), CreateCompound()
Methods: GetType(), IsValid(), IsCompound(), IsCompSolid(), IsSolid(), IsShell(), IsFace(), IsWire(), IsEdge(), IsVertex(), LShape(), ~LShape(), LShape(), operator=(), GetShapeData(), GetVertexData(), GetEdgeData(), GetFaceData(), GetCurve(), GetCurve(), GetSurface(), GetSurface(), GetNbChildren(), IsNull(), IsEqual(), IsSame(), IsPartner(), Transform(), Transformed(), Move(), Moved(), GetOrientation(), SetOrientation(), Oriented(), Reverse(), Reversed(), Complement(), Complemented(), GetFlags(), SetFlags(), IsFree(), SetFree(), IsLocked(), SetLocked(), IsModified(), SetModified(), Nullify(), HashCode(), AddSubShape(), RemoveSubShape(), CanAddSubShape(), ContainsSubShape(), ClearSubShapes(), GetSubShapes(), GetSubShapeCount(), GetTriangulation(), GetPolygon3d()
Enums: ShapeTypeEnum
Types: TypeEnum
Fields
myType
ShapeTypeEnum myType;Methods
Factory Methods
CreateVertex
Create vertex shape from point.
static LShape CreateVertex(const & Point point, double tolerance);point 3D point position tolerance Geometric tolerance (default: 1e-7) Vertex shape
Parameters:
point- 3D point position tolerance Geometric tolerance (default: 1e-7) Vertex shapetolerance- Geometric tolerance (default: 1e-7) Vertex shape
CreateEdge
Create edge shape from curve.
static LShape CreateEdge(const & LCurve curve, double tolerance);curve 3D curve geometry firstParam Start parameter on curve (optional, uses curve bounds if not specified) lastParam End parameter on curve (optional, uses curve bounds if not specified) tolerance Geometric tolerance (default: 1e-7) Edge shape
Parameters:
curve- 3D curve geometry firstParam Start parameter on curve (optional, uses curve bounds if not specified) lastParam End parameter on curve (optional, uses curve bounds if not specified) tolerance Geometric tolerance (default: 1e-7) Edge shapetolerance- Geometric tolerance (default: 1e-7) Edge shape
CreateEdge
static LShape CreateEdge(const & LCurve curve, double firstParam, double lastParam, double tolerance);CreateWire
Create wire shape from collection of edges.
static LShape CreateWire();Empty wire shape (edges can be added using builder methods)
CreateFace
Create face shape from surface.
static LShape CreateFace(const & LSurface surface, double tolerance);surface 3D surface geometry tolerance Geometric tolerance (default: 1e-7) Face shape
Parameters:
surface- 3D surface geometry tolerance Geometric tolerance (default: 1e-7) Face shapetolerance- Geometric tolerance (default: 1e-7) Face shape
CreateFace
Create face shape from surface with UV parameter bounds.
static LShape CreateFace(const & LSurface surface, double uMin, double uMax, double vMin, double vMax, double tolerance);surface 3D surface geometry uMin Minimum U parameter uMax Maximum U parameter vMin Minimum V parameter vMax Maximum V parameter tolerance Geometric tolerance (default: 1e-7) Face shape
Parameters:
surface- 3D surface geometry uMin Minimum U parameter uMax Maximum U parameter vMin Minimum V parameter vMax Maximum V parameter tolerance Geometric tolerance (default: 1e-7) Face shapeuMin- Minimum U parameter uMax Maximum U parameter vMin Minimum V parameter vMax Maximum V parameter tolerance Geometric tolerance (default: 1e-7) Face shapeuMax- Maximum U parameter vMin Minimum V parameter vMax Maximum V parameter tolerance Geometric tolerance (default: 1e-7) Face shapevMin- Minimum V parameter vMax Maximum V parameter tolerance Geometric tolerance (default: 1e-7) Face shapevMax- Maximum V parameter tolerance Geometric tolerance (default: 1e-7) Face shapetolerance- Geometric tolerance (default: 1e-7) Face shape
CreateFaceFromWire
Create face from outer boundary wire.
static LShape CreateFaceFromWire(const & LShape outerWire, double tolerance);outerWire Outer boundary wire defining face perimeter tolerance Geometric tolerance (default: 1e-7) Face shape with wire boundary
Parameters:
outerWire- Outer boundary wire defining face perimeter tolerance Geometric tolerance (default: 1e-7) Face shape with wire boundarytolerance- Geometric tolerance (default: 1e-7) Face shape with wire boundary
CreateFaceFromWires
Create face from outer boundary wire with holes.
static LShape CreateFaceFromWires(const & LShape outerWire, const std::vector< > & LShape holeWires, double tolerance);outerWire Outer boundary wire defining face perimeter holeWires of inner wires defining holes Vector tolerance Geometric tolerance (default: 1e-7) Face shape with boundary and holes
Parameters:
outerWire- Outer boundary wire defining face perimeter holeWires of inner wires defining holes Vector tolerance Geometric tolerance (default: 1e-7) Face shape with boundary and holesholeWires- of inner wires defining holes Vector tolerance Geometric tolerance (default: 1e-7) Face shape with boundary and holestolerance- Geometric tolerance (default: 1e-7) Face shape with boundary and holes
CreateTriangularFace
Create triangular face from three points.
static LShape CreateTriangularFace(const & Point p1, const & Point p2, const & Point p3, double tolerance);p1 First vertex point p2 Second vertex point p3 Third vertex point tolerance Geometric tolerance (default: 1e-7) Triangular face shape
Parameters:
p1- First vertex point p2 Second vertex point p3 Third vertex point tolerance Geometric tolerance (default: 1e-7) Triangular face shapep2- Second vertex point p3 Third vertex point tolerance Geometric tolerance (default: 1e-7) Triangular face shapep3- Third vertex point tolerance Geometric tolerance (default: 1e-7) Triangular face shapetolerance- Geometric tolerance (default: 1e-7) Triangular face shape
CreateRectangularFace
Create rectangular face from four points.
static LShape CreateRectangularFace(const & Point p1, const & Point p2, const & Point p3, const & Point p4, double tolerance);p1 First corner point p2 Second corner point p3 Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular face shape
Parameters:
p1- First corner point p2 Second corner point p3 Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular face shapep2- Second corner point p3 Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular face shapep3- Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular face shapep4- Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular face shapetolerance- Geometric tolerance (default: 1e-7) Rectangular face shape
CreatePolygonalFace
Create polygonal face from array of points.
static LShape CreatePolygonalFace(const std::vector< > & Point points, double tolerance);points of points defining polygon vertices Vector tolerance Geometric tolerance (default: 1e-7) Polygonal face shape
Parameters:
points- of points defining polygon vertices Vector tolerance Geometric tolerance (default: 1e-7) Polygonal face shapetolerance- Geometric tolerance (default: 1e-7) Polygonal face shape
CreateFaceFromTriangulation
Create face from triangulation mesh.
static LShape CreateFaceFromTriangulation(const class & LTriangulation triangulation, double tolerance);triangulation Mesh triangulation data tolerance Geometric tolerance (default: 1e-7) Face shape from triangulation
Parameters:
triangulation- Mesh triangulation data tolerance Geometric tolerance (default: 1e-7) Face shape from triangulationtolerance- Geometric tolerance (default: 1e-7) Face shape from triangulation
CreateEdgeFromPoints
Create straight edge between two points.
static LShape CreateEdgeFromPoints(const & Point startPoint, const & Point endPoint, double tolerance);startPoint Start point of edge endPoint End point of edge tolerance Geometric tolerance (default: 1e-7) Linear edge shape
Parameters:
startPoint- Start point of edge endPoint End point of edge tolerance Geometric tolerance (default: 1e-7) Linear edge shapeendPoint- End point of edge tolerance Geometric tolerance (default: 1e-7) Linear edge shapetolerance- Geometric tolerance (default: 1e-7) Linear edge shape
CreateEdgeFromVertices
Create edge between two existing vertices.
static LShape CreateEdgeFromVertices(const & LShape startVertex, const & LShape endVertex, double tolerance);startVertex Start vertex shape endVertex End vertex shape tolerance Geometric tolerance (default: 1e-7) Linear edge shape connecting vertices
Parameters:
startVertex- Start vertex shape endVertex End vertex shape tolerance Geometric tolerance (default: 1e-7) Linear edge shape connecting verticesendVertex- End vertex shape tolerance Geometric tolerance (default: 1e-7) Linear edge shape connecting verticestolerance- Geometric tolerance (default: 1e-7) Linear edge shape connecting vertices
CreatePolylineEdge
Create polyline edge from array of points.
static LShape CreatePolylineEdge(const std::vector< > & Point points, double tolerance);points of points defining polyline path Vector tolerance Geometric tolerance (default: 1e-7) Polyline edge shape
Parameters:
points- of points defining polyline path Vector tolerance Geometric tolerance (default: 1e-7) Polyline edge shapetolerance- Geometric tolerance (default: 1e-7) Polyline edge shape
CreateArcEdge
Create circular arc edge.
static LShape CreateArcEdge(const & Point center, const & Vector normal, double radius, double startAngle, double endAngle, double tolerance);center Center point of arc normal Normal vector to arc plane radius Arc radius startAngle Start angle in radians endAngle End angle in radians tolerance Geometric tolerance (default: 1e-7) Circular arc edge shape
Parameters:
center- Center point of arc normal Normal vector to arc plane radius Arc radius startAngle Start angle in radians endAngle End angle in radians tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapenormal- Normal vector to arc plane radius Arc radius startAngle Start angle in radians endAngle End angle in radians tolerance Geometric tolerance (default: 1e-7) Circular arc edge shaperadius- Arc radius startAngle Start angle in radians endAngle End angle in radians tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapestartAngle- Start angle in radians endAngle End angle in radians tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapeendAngle- End angle in radians tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapetolerance- Geometric tolerance (default: 1e-7) Circular arc edge shape
CreateArcEdgeThrough3Points
Create circular arc edge through three points.
static LShape CreateArcEdgeThrough3Points(const & Point startPoint, const & Point middlePoint, const & Point endPoint, double tolerance);startPoint Start point of arc middlePoint Middle point on arc endPoint End point of arc tolerance Geometric tolerance (default: 1e-7) Circular arc edge shape
Parameters:
startPoint- Start point of arc middlePoint Middle point on arc endPoint End point of arc tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapemiddlePoint- Middle point on arc endPoint End point of arc tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapeendPoint- End point of arc tolerance Geometric tolerance (default: 1e-7) Circular arc edge shapetolerance- Geometric tolerance (default: 1e-7) Circular arc edge shape
CreateWireFromEdges
Create wire from ordered collection of edges.
static LShape CreateWireFromEdges(const std::vector< > & LShape edges, double tolerance);edges of connected edges Vector tolerance Geometric tolerance (default: 1e-7) Wire shape
Parameters:
edges- of connected edges Vector tolerance Geometric tolerance (default: 1e-7) Wire shapetolerance- Geometric tolerance (default: 1e-7) Wire shape
CreateRectangularWire
Create rectangular wire from corner points.
static LShape CreateRectangularWire(const & Point p1, const & Point p2, const & Point p3, const & Point p4, double tolerance);p1 First corner point p2 Second corner point p3 Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular wire shape
Parameters:
p1- First corner point p2 Second corner point p3 Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular wire shapep2- Second corner point p3 Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular wire shapep3- Third corner point p4 Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular wire shapep4- Fourth corner point tolerance Geometric tolerance (default: 1e-7) Rectangular wire shapetolerance- Geometric tolerance (default: 1e-7) Rectangular wire shape
CreatePolygonalWire
Create polygonal wire from array of points.
static LShape CreatePolygonalWire(const std::vector< > & Point points, bool closed, double tolerance);points of points defining polygon vertices Vector closed Whether to close the polygon (default: true) tolerance Geometric tolerance (default: 1e-7) Polygonal wire shape
Parameters:
points- of points defining polygon vertices Vector closed Whether to close the polygon (default: true) tolerance Geometric tolerance (default: 1e-7) Polygonal wire shapeclosed- Whether to close the polygon (default: true) tolerance Geometric tolerance (default: 1e-7) Polygonal wire shapetolerance- Geometric tolerance (default: 1e-7) Polygonal wire shape
CreateShell
Create shell shape from collection of faces.
static LShape CreateShell();Empty shell shape (faces can be added using builder methods)
CreateSolid
Create solid shape from shell.
static LShape CreateSolid();Empty solid shape (shells can be added using builder methods)
CreateCompound
Create compound shape from collection of shapes.
static LShape CreateCompound();Empty compound shape (shapes can be added using builder methods)
Instance Methods
GetType
Get the current shape type.
ShapeTypeEnum GetType() const;Shape type enumeration value
IsValid
Check if shape is valid (not null or undefined).
bool IsValid() const;True if shape is valid
IsCompound
bool IsCompound() const;IsCompSolid
bool IsCompSolid() const;IsSolid
bool IsSolid() const;IsShell
bool IsShell() const;IsFace
bool IsFace() const;IsWire
bool IsWire() const;IsEdge
bool IsEdge() const;IsVertex
bool IsVertex() const;LShape
Default constructor creates undefined shape.
LShape() const;~LShape
Destructor.
~LShape() const;LShape
Copy constructor.
LShape(const & LShape other) const;operator=
Assignment operator.
& LShape operator=(const & LShape other) const;GetShapeData
Get complete shape data for cross-language exchange.
ShapeData GetShapeData() const;POD structure with all shape metadata ShapeData
GetVertexData
Get vertex-specific data (valid only for VERTEX shapes).
VertexData GetVertexData() const;POD structure with point position and tolerance VertexData
GetEdgeData
Get edge-specific data (valid only for EDGE shapes).
EdgeData GetEdgeData() const;POD structure with parameter bounds and properties EdgeData
GetFaceData
Get face-specific data (valid only for FACE shapes).
FaceData GetFaceData() const;POD structure with UV parameter bounds FaceData
GetCurve
Extract curve geometry from edge shape.
LCurve GetCurve() const;geometry (valid only for EDGE shapes) LCurve
GetCurve
Extract curve geometry from edge shape with parameter bounds.
LCurve GetCurve(double & firstParam, double & lastParam) const;firstParam Output parameter for curve start lastParam Output parameter for curve end geometry (valid only for EDGE shapes) LCurve
Parameters:
firstParam- Output parameter for curve start lastParam Output parameter for curve end geometry (valid only for EDGE shapes) LCurvelastParam- Output parameter for curve end geometry (valid only for EDGE shapes) LCurve
GetSurface
Extract surface geometry from face shape.
LSurface GetSurface() const;geometry (valid only for FACE shapes) LSurface
GetSurface
Extract surface geometry from face shape with parameter bounds.
LSurface GetSurface(double & uMin, double & uMax, double & vMin, double & vMax) const;uMin Output parameter for minimum U bound uMax Output parameter for maximum U bound vMin Output parameter for minimum V bound vMax Output parameter for maximum V bound geometry (valid only for FACE shapes) LSurface
Parameters:
uMin- Output parameter for minimum U bound uMax Output parameter for maximum U bound vMin Output parameter for minimum V bound vMax Output parameter for maximum V bound geometry (valid only for FACE shapes) LSurfaceuMax- Output parameter for maximum U bound vMin Output parameter for minimum V bound vMax Output parameter for maximum V bound geometry (valid only for FACE shapes) LSurfacevMin- Output parameter for minimum V bound vMax Output parameter for maximum V bound geometry (valid only for FACE shapes) LSurfacevMax- Output parameter for maximum V bound geometry (valid only for FACE shapes) LSurface
GetNbChildren
Get number of direct sub-shapes (children).
int GetNbChildren() const;Number of child shapes
IsNull
Check if shape is null (no underlying geometry).
bool IsNull() const;True if shape is null
IsEqual
Check if shape is equal to another shape.
bool IsEqual(const & LShape other) const;other Other shape to compare True if shapes are equal
Parameters:
other- Other shape to compare True if shapes are equal
IsSame
Check if shape is same as another (shares same underlying data).
bool IsSame(const & LShape other) const;other Other shape to compare True if shapes are same
Parameters:
other- Other shape to compare True if shapes are same
IsPartner
Check if shape is partner of another (same TShape, different location/orientation).
bool IsPartner(const & LShape other) const;other Other shape to compare True if shapes are partners
Parameters:
other- Other shape to compare True if shapes are partners
Transform
Transform shape in place.
void Transform(const class & LTransform transform) const;transform 3D transformation to apply
Parameters:
transform- 3D transformation to apply
Transformed
Get transformed copy of shape.
LShape Transformed(const class & LTransform transform) const;transform 3D transformation to apply New transformed shape
Parameters:
transform- 3D transformation to apply New transformed shape
Move
Move shape by location transformation.
void Move(const & TransformationData location) const;location Location transformation to apply
Parameters:
location- Location transformation to apply
Moved
Get moved copy of shape.
LShape Moved(const & TransformationData location) const;location Location transformation to apply New moved shape
Parameters:
location- Location transformation to apply New moved shape
GetOrientation
Get shape orientation.
ShapeOrientation GetOrientation() const;Shape orientation enumeration
SetOrientation
Set shape orientation.
void SetOrientation(ShapeOrientation orientation) const;orientation New orientation
Parameters:
orientation- New orientation
Oriented
Get oriented copy of shape.
LShape Oriented(ShapeOrientation orientation) const;orientation Desired orientation New oriented shape
Parameters:
orientation- Desired orientation New oriented shape
Reverse
Reverse shape orientation.
void Reverse() const;Reversed
Get reversed copy of shape.
LShape Reversed() const;New reversed shape
Complement
Complement shape orientation.
void Complement() const;Complemented
Get complemented copy of shape.
LShape Complemented() const;New complemented shape
GetFlags
Get all shape state flags.
ShapeFlags GetFlags() const;POD structure ShapeFlags
SetFlags
Set shape state flags.
void SetFlags(const & ShapeFlags flags) const;flags New flags to set
Parameters:
flags- New flags to set
IsFree
bool IsFree() const;SetFree
void SetFree(bool free) const;IsLocked
bool IsLocked() const;SetLocked
void SetLocked(bool locked) const;IsModified
bool IsModified() const;SetModified
void SetModified(bool modified) const;Nullify
Make shape null (remove all geometry).
void Nullify() const;HashCode
Get hash code for shape.
size_t HashCode() const;Hash code integer
AddSubShape
Add a sub-shape to this compound/collection shape. This method only works for compound shapes and uses OCCT builders internally.
bool AddSubShape(const & LShape subShape, ShapeOrientation orientation) const;subShape Shape to add as a child orientation Orientation for the added shape (default: FORWARD) True if sub-shape was successfully added, false otherwise
Parameters:
subShape- Shape to add as a child orientation Orientation for the added shape (default: FORWARD) True if sub-shape was successfully added, false otherwiseorientation- Orientation for the added shape (default: FORWARD) True if sub-shape was successfully added, false otherwise
RemoveSubShape
Remove a sub-shape from this compound/collection shape. This method only works for compound shapes and uses OCCT builders internally.
bool RemoveSubShape(const & LShape subShape) const;subShape Shape to remove from children True if sub-shape was successfully removed, false otherwise
Parameters:
subShape- Shape to remove from children True if sub-shape was successfully removed, false otherwise
CanAddSubShape
Check if a specific sub-shape can be added to this shape. Validates type hierarchy rules (e.g., compounds can contain any shapes, solids can contain shells, etc.)
bool CanAddSubShape(const & LShape subShape) const;subShape Shape to test for addition compatibility True if the sub-shape can be added to this shape
Parameters:
subShape- Shape to test for addition compatibility True if the sub-shape can be added to this shape
ContainsSubShape
Check if a specific sub-shape exists as a direct child. Uses shape comparison to find matching sub-shapes.
bool ContainsSubShape(const & LShape subShape) const;subShape Shape to search for in children True if the sub-shape is found as a direct child
Parameters:
subShape- Shape to search for in children True if the sub-shape is found as a direct child
ClearSubShapes
Clear all sub-shapes from this compound/collection shape. This method only works for compound shapes and creates a new empty compound.
bool ClearSubShapes() const;True if sub-shapes were successfully cleared, false otherwise
GetSubShapes
Get all direct sub-shapes as a vector. Uses internal iteration to collect all immediate children.
std::vector< > LShape GetSubShapes() const;of all direct child shapes Vector
GetSubShapeCount
Get count of direct sub-shapes. More efficient than .size() for count-only operations. GetSubShapes()
int GetSubShapeCount() const;Number of direct child shapes
GetTriangulation
Extract triangulation data from meshed faces in the shape. This method extracts all triangulation data from faces that have been meshed using mesh generation methods (like QuickMesh from ). LMesher
std::vector< class > LTriangulation GetTriangulation() const;of triangulations from all meshed faces, empty vector if none found Vector
GetPolygon3d
Extract polygon data from meshed edges in the shape. This method extracts all polygon data from edges that have been meshed using mesh generation methods.
std::vector< class > LPolygon3d GetPolygon3d() const;of polygons from all meshed edges, empty vector if none found Vector
Enumerations
ShapeTypeEnum
Shape type enumeration following OCCT TopAbs_ShapeEnum. Defines all possible topological shape types.
enum ShapeTypeEnum {
SHAPE_COMPOUND, // A group of any of the shapes below.
SHAPE_COMPSOLID, // A set of solids connected by their faces.
SHAPE_SOLID, // A part of 3D space bounded by shells.
SHAPE_SHELL, // A set of faces connected by edges.
SHAPE_FACE, // Part of a surface bounded by a closed wire.
SHAPE_WIRE, // A sequence of edges connected by vertices.
SHAPE_EDGE, // A curve bound by vertices at extremities.
SHAPE_VERTEX, // A zero-dimensional shape (point)
SHAPE_UNDEFINED, // Invalid/undefined shape type.
};Type Definitions
TypeEnum
Generic type alias for templates.
ShapeTypeEnum TypeEnum;LightOcct::LShapeExplorer
Light OCCT wrapper for TopExp_Explorer with enum + Handle pattern.
Provides hierarchical exploration of shapes to find sub-shapes of specific types. Follows Light OCCT architectural patterns: Enum + Handle pattern for type-safe storage POD structures for cross-language data exchange Wrapper methods using only Light OCCT types No OCCT types exposed in public interface Exploration Logic (following OCCT TopExp_Explorer): Explores sub-shapes in hierarchical order: COMPOUND -> COMPSOLID -> SOLID -> SHELL -> FACE -> WIRE -> EDGE -> VERTEX Can explore all sub-shapes of a given type within a shape Can avoid sub-shapes of a specific type during exploration Maintains iteration state for sequential access Usage Example: LShapecompound=CreateSomeCompoundShape(); //Findallfacesinthecompound explorer(compound,); LShapeExplorer LShape::SHAPE_FACE while (explorer.More()){ LShapeface=explorer.Current(); //Processtheface explorer.Next(); } //Findalledgesnotcontainedinwires edgeExplorer(compound,,); LShapeExplorer LShape::SHAPE_EDGE LShape::SHAPE_WIRE for (edgeExplorer.Init();edgeExplorer.More();edgeExplorer.Next())
#include <light-occt/topology/LShapeExplorer.hxx>Quick Reference
Fields: myState, myRootShape, myToFind, myToAvoid
Methods: GetState(), IsInitialized(), More(), LShapeExplorer(), LShapeExplorer(), LShapeExplorer(), ~LShapeExplorer(), LShapeExplorer(), operator=(), Init(), Init(), ReInit(), Current(), Next(), Count(), IsFirst(), GetRootShape(), GetToFind(), GetToAvoid(), HasAvoidance(), GetExplorerData(), GetAllShapes(), Reset(), IsDone(), CurrentAndNext()
Enums: ExplorerState
Fields
myState
ExplorerState myState;myRootShape
LShape myRootShape;myToFind
LShape::ShapeTypeEnum myToFind;myToAvoid
LShape::ShapeTypeEnum myToAvoid;Methods
Instance Methods
GetState
Get the current explorer state.
ExplorerState GetState() const;Explorer state enumeration value
IsInitialized
Check if explorer is initialized and ready.
bool IsInitialized() const;True if explorer is ready for iteration
More
Check if more shapes are available for iteration.
bool More() const;True if more shapes can be accessed
LShapeExplorer
Default constructor creates uninitialized explorer.
LShapeExplorer() const;LShapeExplorer
Constructor with shape and type to find.
LShapeExplorer(const & LShape shape, LShape::ShapeTypeEnum toFind) const;shape Root shape to explore toFind Type of sub-shapes to find
Parameters:
shape- Root shape to explore toFind Type of sub-shapes to findtoFind- Type of sub-shapes to find
LShapeExplorer
Constructor with shape, type to find, and type to avoid.
LShapeExplorer(const & LShape shape, LShape::ShapeTypeEnum toFind, LShape::ShapeTypeEnum toAvoid) const;shape Root shape to explore toFind Type of sub-shapes to find toAvoid Type of sub-shapes to avoid during exploration
Parameters:
shape- Root shape to explore toFind Type of sub-shapes to find toAvoid Type of sub-shapes to avoid during explorationtoFind- Type of sub-shapes to find toAvoid Type of sub-shapes to avoid during explorationtoAvoid- Type of sub-shapes to avoid during exploration
~LShapeExplorer
Destructor.
~LShapeExplorer() const;LShapeExplorer
Copy constructor.
LShapeExplorer(const & LShapeExplorer other) const;operator=
Assignment operator.
& LShapeExplorer operator=(const & LShapeExplorer other) const;Init
Initialize explorer with shape and type to find.
void Init(const & LShape shape, LShape::ShapeTypeEnum toFind) const;shape Root shape to explore toFind Type of sub-shapes to find
Parameters:
shape- Root shape to explore toFind Type of sub-shapes to findtoFind- Type of sub-shapes to find
Init
Initialize explorer with shape, type to find, and type to avoid.
void Init(const & LShape shape, LShape::ShapeTypeEnum toFind, LShape::ShapeTypeEnum toAvoid) const;shape Root shape to explore toFind Type of sub-shapes to find toAvoid Type of sub-shapes to avoid during exploration
Parameters:
shape- Root shape to explore toFind Type of sub-shapes to find toAvoid Type of sub-shapes to avoid during explorationtoFind- Type of sub-shapes to find toAvoid Type of sub-shapes to avoid during explorationtoAvoid- Type of sub-shapes to avoid during exploration
ReInit
Reinitialize explorer with current settings. Resets iteration to the beginning.
void ReInit() const;Current
Get the current shape in iteration.
LShape Current() const;Current shape (valid only when returns true) More()
Next
Advance to the next shape in iteration.
void Next() const;Count
Get total count of shapes that will be found. Note: This method iterates through all shapes to count them, then resets the explorer.
int Count() const;Total number of shapes of the specified type
IsFirst
Check if current shape is the first in iteration.
bool IsFirst() const;True if this is the first shape
GetRootShape
Get the root shape being explored.
LShape GetRootShape() const;Root shape
GetToFind
Get the type of shapes being found.
LShape::ShapeTypeEnum GetToFind() const;Shape type enumeration
GetToAvoid
Get the type of shapes being avoided.
LShape::ShapeTypeEnum GetToAvoid() const;Shape type enumeration (SHAPE_UNDEFINED if no avoidance)
HasAvoidance
Check if explorer is configured to avoid a specific type.
bool HasAvoidance() const;True if avoidance is configured
GetExplorerData
Get explorer configuration data for cross-language exchange.
ExplorerData GetExplorerData() const;POD structure ExplorerData
GetAllShapes
Get complete iteration results as vector of shapes. Note: This method performs complete iteration and returns all found shapes.
std::vector< > LShape GetAllShapes() const;of all shapes found by the explorer Vector
Reset
Reset explorer to the beginning of iteration.
void Reset() const;IsDone
Check if explorer has reached the end.
bool IsDone() const;True if no more shapes are available
CurrentAndNext
Get current shape and advance to next (convenience method).
LShape CurrentAndNext() const;Current shape, then advances iterator
Enumerations
ExplorerState
Explorer state enumeration for iteration status.
enum ExplorerState {
EXPLORER_INITIALIZED, // Explorer is initialized and ready.
EXPLORER_MORE, // More shapes available for iteration.
EXPLORER_DONE, // No more shapes to explore.
EXPLORER_UNDEFINED, // Explorer is not initialized.
};LightOcct::LShapeIterator
Light OCCT wrapper for TopoDS_Iterator with enum + Handle pattern.
Provides direct iteration over immediate sub-shapes of a compound shape. Follows Light OCCT architectural patterns: Enum + Handle pattern for type-safe storage POD structures for cross-language data exchange Wrapper methods using only Light OCCT types No OCCT types exposed in public interface Iterator Logic (following OCCT TopoDS_Iterator): Iterates only over direct children of the given shape Does NOT recurse into sub-shapes (use for hierarchical exploration) LShapeExplorer Maintains original orientation and location of sub-shapes Provides access to both shape and its orientation Difference from : LShapeExplorer : Iterates direct children only (like TopoDS_Iterator) LShapeIterator : Hierarchically explores all sub-shapes of a type (like TopExp_Explorer) LShapeExplorer Usage Example: LShapecompound=CreateSomeCompoundShape(); //Iteratethroughdirectchildrenonly iterator(compound); LShapeIterator while (iterator.More()){ LShapechild=iterator.Current(); orientation=iterator.CurrentOrientation(); ShapeOrientation //Processthechildshape iterator.Next(); } //Alternativeiterationstyle for (it(compound);it.More();it.Next())
#include <light-occt/topology/LShapeIterator.hxx>Quick Reference
Fields: myState, myRootShape, myCumulOrientation, myCumulLocation
Methods: GetState(), IsInitialized(), More(), LShapeIterator(), LShapeIterator(), LShapeIterator(), ~LShapeIterator(), LShapeIterator(), operator=(), Init(), Init(), ReInit(), Current(), CurrentOrientation(), CurrentShapeData(), Next(), Count(), IsFirst(), GetRootShape(), GetCumulativeOrientation(), GetCumulativeLocation(), GetIteratorData(), GetAllShapes(), GetAllShapeData(), Reset(), IsDone(), CurrentAndNext(), CurrentDataAndNext()
Enums: IteratorState
Fields
myState
IteratorState myState;myRootShape
LShape myRootShape;myCumulOrientation
bool myCumulOrientation;myCumulLocation
bool myCumulLocation;Methods
Instance Methods
GetState
Get the current iterator state.
IteratorState GetState() const;Iterator state enumeration value
IsInitialized
Check if iterator is initialized and ready.
bool IsInitialized() const;True if iterator is ready for iteration
More
Check if more shapes are available for iteration.
bool More() const;True if more shapes can be accessed
LShapeIterator
Default constructor creates uninitialized iterator.
LShapeIterator() const;LShapeIterator
Constructor with shape to iterate.
LShapeIterator(const & LShape shape) const;shape Root shape whose children to iterate
Parameters:
shape- Root shape whose children to iterate
LShapeIterator
Constructor with shape and orientation/location flags.
LShapeIterator(const & LShape shape, bool cumulOrientation, bool cumulLocation) const;shape Root shape whose children to iterate cumulOrientation If true, compose orientations cumulLocation If true, compose locations
Parameters:
shape- Root shape whose children to iterate cumulOrientation If true, compose orientations cumulLocation If true, compose locationscumulOrientation- If true, compose orientations cumulLocation If true, compose locationscumulLocation- If true, compose locations
~LShapeIterator
Destructor.
~LShapeIterator() const;LShapeIterator
Copy constructor.
LShapeIterator(const & LShapeIterator other) const;operator=
Assignment operator.
& LShapeIterator operator=(const & LShapeIterator other) const;Init
Initialize iterator with shape.
void Init(const & LShape shape) const;shape Root shape whose children to iterate
Parameters:
shape- Root shape whose children to iterate
Init
Initialize iterator with shape and composition flags.
void Init(const & LShape shape, bool cumulOrientation, bool cumulLocation) const;shape Root shape whose children to iterate cumulOrientation If true, compose orientations cumulLocation If true, compose locations
Parameters:
shape- Root shape whose children to iterate cumulOrientation If true, compose orientations cumulLocation If true, compose locationscumulOrientation- If true, compose orientations cumulLocation If true, compose locationscumulLocation- If true, compose locations
ReInit
Reinitialize iterator with current settings. Resets iteration to the beginning.
void ReInit() const;Current
Get the current shape in iteration.
LShape Current() const;Current child shape (valid only when returns true) More()
CurrentOrientation
Get the orientation of current shape.
ShapeOrientation CurrentOrientation() const;Current shape orientation relative to parent
CurrentShapeData
Get current shape data including orientation and location.
ShapeData CurrentShapeData() const;Complete shape data POD structure
Next
Advance to the next shape in iteration.
void Next() const;Count
Get total count of direct children. Note: This method iterates through all children to count them, then resets the iterator.
int Count() const;Total number of direct child shapes
IsFirst
Check if current shape is the first in iteration.
bool IsFirst() const;True if this is the first child shape
GetRootShape
Get the root shape being iterated.
LShape GetRootShape() const;Root shape
GetCumulativeOrientation
Check if iterator is configured to cumulate orientations.
bool GetCumulativeOrientation() const;True if orientations are being composed
GetCumulativeLocation
Check if iterator is configured to cumulate locations.
bool GetCumulativeLocation() const;True if locations are being composed
GetIteratorData
Get iterator configuration data for cross-language exchange.
IteratorData GetIteratorData() const;POD structure IteratorData
GetAllShapes
Get complete iteration results as vector of shapes. Note: This method performs complete iteration and returns all child shapes.
std::vector< > LShape GetAllShapes() const;of all direct child shapes Vector
GetAllShapeData
Get complete iteration results with orientations. Note: This method performs complete iteration and returns all child shapes with their orientations.
std::vector< > ShapeData GetAllShapeData() const;of all child shapes and their orientation data Vector
Reset
Reset iterator to the beginning of iteration.
void Reset() const;IsDone
Check if iterator has reached the end.
bool IsDone() const;True if no more shapes are available
CurrentAndNext
Get current shape and advance to next (convenience method).
LShape CurrentAndNext() const;Current shape, then advances iterator
CurrentDataAndNext
Get current shape data and advance to next (convenience method).
ShapeData CurrentDataAndNext() const;Current shape data, then advances iterator
Enumerations
IteratorState
Iterator state enumeration for iteration status.
enum IteratorState {
ITERATOR_INITIALIZED, // Iterator is initialized and ready.
ITERATOR_MORE, // More shapes available for iteration.
ITERATOR_DONE, // No more shapes to iterate.
ITERATOR_UNDEFINED, // Iterator is not initialized.
};