What is the difference between TopExp_Explorer and TopoDS_Iterator

TopExp_Explorer vs TopoDS_Iterator


In Open CASCADE Technology (OCCT) library, TopExp_Explorer and TopoDS_Iterator classes provide a way to iterate over sub-shapes of a given shape. But there are differences between these two classes.

TopoDS_Iterator is a simpler class which provides basic iteration over sub-shapes of a given shape. It does not have advanced features for exploring a shape's topology. Also, it does not have the capability to filter the sub-shapes based on their type.

TopExp_Explorer has more advanced features to explore the topology of a shape. It allows one to select what sub-shape type wants to filter out (eg: vertex, edge, wire, face, shell, solid, etc.) and allows one to avoid a selected sub-shape type.

Key differences

Here are the key differences.

Filtering

TopExp_Explorer allows filtering the sub-shapes based on their type while TopoDS_Iterator does not provide this feature.

Flexibility

TopExp_Explorer is more flexible than TopoDS_Iterator because it allows one to choose the order of the sub-shapes to be explored and provides more control over the exploration process.

If you need more advanced topology exploration on a shape or more control over the exploration process, it is better to use TopExp_Explorer class. If you want to iterate over sub-shapes simply, you can use TopoDS_Iterator.

You can find an example in the following article. Explore your shape using OPEN CASCADE

Examples

You can find how to use TopoDS_Iterator here.

You can find how to use TopoExp_Explorer here.

Post a Comment

Previous Post Next Post