Hide menu
Loading...
Searching...
No Matches
cadex.ModelData.ShapeIterator Class Reference

Iterates over subshapes in a shape. More...

Inheritance diagram for cadex.ModelData.ShapeIterator:
cadex.BaseObject

Public Member Functions

 ShapeIterator (global::System.IntPtr cPtr, bool cMemoryOwn)
 
System.Collections.Generic.IEnumerator< cadex.ModelData.ShapeGetEnumerator ()
 
 ShapeIterator (cadex.ModelData.Body theBody)
 
 ShapeIterator (cadex.ModelData.Shape theShape)
 
 ShapeIterator (cadex.ModelData.Body theBody, cadex.ModelData.ShapeType theType)
 
 ShapeIterator (cadex.ModelData.Shape theShape, cadex.ModelData.ShapeType theType)
 
bool HasNext ()
 
cadex.ModelData.Shape Next ()
 
- Public Member Functions inherited from cadex.BaseObject
 BaseObject (global::System.IntPtr cPtr, bool cMemoryOwn)
 
void Dispose ()
 
bool IsNull ()
 
ulong Id ()
 Return unique identifier of public object.
 
bool IsEqual (cadex.BaseObject theObj)
 
override int GetHashCode ()
 
override bool Equals (System.Object o)
 

Static Public Member Functions

static cadex.ModelData.ShapeIterator Cast (cadex.BaseObject theBase)
 

Protected Member Functions

override void Dispose (bool disposing)
 

Detailed Description

Iterates over subshapes in a shape.

Iterator supports two usage scenario:

  • iteration over direct children;
  • iteration over subshapes of a specified type.

Exploration of Direct Children

To retrive direct children of a shape, ModelData.ShapeIterator should be used as follows:

ModelData::Wire aWire = ...;
while (i.HasNext()) {
const ModelData::Shape& aChild = i.Next(); //edge
ModelData::ShapeType aType = aChild.Type();
assert (aType == ModelData::ShapeType::Edge);
}
Base class of topological shapes.
Definition Shape.cs:178
cadex.ModelData.ShapeType Type()
Returns a shape type. For a null object returns Undefined.
Definition Shape.cs:222
Iterates over subshapes in a shape.
Definition ShapeIterator.cs:58
Defines a connected set of edges.
Definition Wire.cs:30
ShapeType
Defines shape type.
Definition ShapeType.cs:17

Exploration of particular types

To retrive children of a particular type, ModelData.ShapeIterator should be used by specifying a type of interest as follows:

ModelData::Solid aSolid = ...;
ModelData::ShapeIterator i (aSolid, ModelData::ShapeType_Edge); //iterate over edges in the solid
while (i.HasNext()) {
ModelData::Shape aChild = i.Next();
const ModelData::Edge& anEdge = static_cast<const ModelData::Edge&> (aChild); //edge
...
}
Defines an edge.
Definition Edge.cs:146
Defines a topological solid.
Definition Solid.cs:25

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.

Examples
MTKConverter/Program.cs, MTKConverter/main.cxx, exploring/brep_geometry/Program.cs, exploring/brep_geometry/main.cxx, exploring/brep_topology/Program.cs, exploring/brep_topology/main.cxx, helpers/shape_processor.cs, helpers/shape_processor.hxx, machining/dfm_analyzer/Program.cs, machining/dfm_analyzer/main.cxx, machining/feature_recognizer/Program.cs, machining/feature_recognizer/main.cxx, meshing/mesh_generation/Program.cs, meshing/mesh_generation/main.cxx, molding/dfm_analyzer/Program.cs, molding/dfm_analyzer/main.cxx, molding/feature_recognizer/Program.cs, molding/feature_recognizer/main.cxx, sheet_metal/dfm_analyzer/Program.cs, sheet_metal/dfm_analyzer/main.cxx, sheet_metal/feature_recognizer/Program.cs, sheet_metal/feature_recognizer/main.cxx, sheet_metal/unfolder/Program.cs, and sheet_metal/unfolder/main.cxx.

Member Function Documentation

◆ Dispose()

override void cadex.ModelData.ShapeIterator.Dispose ( bool disposing)
inlineprotectedvirtual

Reimplemented from cadex.BaseObject.