X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_ShapeTools.cpp;h=31087ffc083a621c2c384d1186852ea1528ef11a;hb=c856f50b73f4a8ac6c13cc657f0b68cbcd5ae76f;hp=1a10fc35390f651ba9e8fe7e00340213e0cbb1ad;hpb=16f385d064658d196e5af5f1f8d8ffc0b944bdec;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 1a10fc353..31087ffc0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -1781,3 +1781,20 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll(const ListOfShape& theObjects, } } } + +ListOfShape GeomAlgoAPI_ShapeTools::getSharedFaces(const GeomShapePtr& theShape) +{ + ListOfShape aSharedFaces; + TopTools_IndexedDataMapOfShapeListOfShape aMapFS; + TopExp::MapShapesAndUniqueAncestors(theShape->impl(), + TopAbs_FACE, TopAbs_SOLID, aMapFS); + for (Standard_Integer i = 1; i <= aMapFS.Extent(); i++) { + const TopTools_ListOfShape& ancestors = aMapFS.FindFromIndex(i); + if (ancestors.Size() > 1) { + GeomShapePtr aFace(new GeomAPI_Shape); + aFace->setImpl(new TopoDS_Shape(aMapFS.FindKey(i))); + aSharedFaces.push_back(aFace); + } + } + return aSharedFaces; +}