Extract only solid from shape


I have a problem with extracting a solid from a shape. I have a shape with this specifications:

FACES : 102
WIRES : 102
EDGES : 404
Compounds: 1
CompSolids: 0

Now I want to get only the solid, but without all unnecessary faces. When using TopExp_Explorer Ex(myShape,TopAbs_SOLID) - I get the Solid and ALL other faces and edges. Is there the possibility to get only the shape without the faces in the middle of the solid?

Thanks in advance!

Svetlozar Kostadinov's picture

The solid is based on other underlying topology objects - always one closed shell, the closed shell is based on couple of faces and so on. As far as I know, the data is kept only in the underlying objects. If you just want to reject the faces, you could you TopExp_Explorer::Depth() to limit the traversal only at the desired level. Or try to use the third parameter of the constructor and set it to TopoAbs_FACE.


Markus's picture

TopExp_Explorer::Depth() sounds interesting, but I could not find any examples. Maybe someone here who has used this function in a similar context?

xiuerlee's picture

std::vector theSolidVec;

for ( TopoExp_Explorer Ex(myShape, TopAbs_SOLID); Ex.More(); Ex.Next() ) {

TopoDS_Shape theSolid = TopoDS::Solid( Ex.Current());
theSolidVec.push_back( theSolid );

for ( std::vectro::iterator shape = theSolidVec.begin()
; shape != theSolidVec.end()
; ++shape )
myAISContext->Display(Handle(AIS_Shape)(new AIS_Shape(*shape),Standard_False );

If you want to get the face of the shape, you could use TopExp_Explorer(myShape, TopAbs_FACE).