For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Help with Neighbor faces and common edge

Game Milky's picture

Dear Forum supervisors and users,

I want to extract the neighbor faces and the common edges of my model (shape). I try to use TopExp::MapShapesAndAncestors(shape, TopAbs_EDGE, TopAbs_FACE, myMap); but not successful, I tried as follow:

TopTools_IndexedDataMapOfShapeListOfShape myMap;
TopExp::MapShapesAndAncestors(shape, TopAbs_EDGE, TopAbs_FACE, myMap);
Standard_Integer aNbE=myMap.Extent();
for(int j=1; j {
const TopoDS_Edge& aE=TopoDS::Edge(myMap.FindKey(j));
const TopTools_ListOfShape& LF=myMap(j);
Standard_Integer aNbF =LF.Extent();
if (aNbF>=2)
const TopoDS_Face& Face1 = TopoDS::Face(myMap.FindFromIndex(1).First());
const TopoDS_Face& Face2 = TopoDS::Face(myMap.FindFromIndex(2).Last());
Handle(Geom_Surface) surfaceA = BRep_Tool::Surface(Face1);
Handle(Geom_Surface) surfaceB = BRep_Tool::Surface(Face2);

Have no compiling error but, doesn't give a correct result! Any error in using this class!

Any suggestion??