-// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
}
}
+
+ListOfShape GeomAlgoAPI_ShapeTools::getSharedFaces(const GeomShapePtr& theShape)
+{
+ ListOfShape aSharedFaces;
+ TopTools_IndexedDataMapOfShapeListOfShape aMapFS;
+ TopExp::MapShapesAndUniqueAncestors(theShape->impl<TopoDS_Shape>(),
+ 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<TopoDS_Shape>(new TopoDS_Shape(aMapFS.FindKey(i)));
+ aSharedFaces.push_back(aFace);
+ }
+ }
+ return aSharedFaces;
+}