If I traverse the Solids under a Shape, and then iterate through the Faces within each Solid, will that give me all the Faces?
I tried doing this, but the Faces I obtained were only a subset.
Discussion
3 archived replies
Posts are displayed in their archived order.
01Commenter-1
Does "solid" in OCC correspond to "body"?
From Training: Topology - TopoDS_Solid is a collection of TopoDS_Shell, and TopoDS_Shell is a collection of TopoDS_Face.
The 'body' from other kernels might have different type - closed solid (can be roughly mapped to TopoDS_Solid), open sheet (can be mapped to TopoDS_Shell, which is not inside of a TopoDS_Solid), acorn (corresponds to TopoDS_Vertex which is not part of any TopoDS_Edge).
If I traverse the Solids under a Shape, and then iterate through the Faces within each Solid, will that give me all the Faces?
The simplest Solid like a sphere will consist of one Shell and 1+ Faces.
The Solid with inner hole parts (imagine a small sphere cut from a larger box) will consists of one outer Shell and 1+ inner hole Shells.
I tried doing this, but the Faces I obtained were only a subset.
There are different ways to traverse topology in OCCT.
Please share some sample shape, code snippet and why you think you get unexpected result.
02Author
Thanks for your answer.
Here is my code snippet.
// the TopoShape from a STEP file
// then use convertToBody function
for (TopExp_Explorer aSolidExp(aTopoShape, TopAbs_SOLID); aSolidExp.More(); aSolidExp.Next(), index++)
{
m_aDebugLog << std::format("\nSolid[{}]:", index) << std::endl;
TopoDS_Solid aTopoSolid = TopoDS::Solid(aSolidExp.Current());
Body* aBody = convertToBody(aTopoSolid);
m_aBodyVec.push_back(aBody);
}
This TopoShape comes from a STEP file, maybe some problem about map in present code. I find that so many faces isn't in solids. I don't know how to correctly traverse and store these structures.