Salome HOME
La part
[modules/shaper.git] / src / FiltersPlugin / FiltersPlugin_ExternalFaces.cpp
index 1ad322537f1817e6f6d3a84f7f6130f90b96fa6c..51e7f1edd7dfe8dce6ae20f60f114c65e25b34fd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -31,11 +31,17 @@ bool FiltersPlugin_ExternalFaces::isSupported(GeomAPI_Shape::ShapeType theType)
 
 bool FiltersPlugin_ExternalFaces::isOk(const GeomShapePtr& theShape,
                                        const ResultPtr& theResult,
-                                       const ModelAPI_FiltersArgs& theArgs) const
+                                       const ModelAPI_FiltersArgs& /*theArgs*/) const
 {
   if (!theShape->isFace())
     return false;
 
+  // verify INTERNAL flag
+  TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+  if (aShape.Orientation() == TopAbs_INTERNAL)
+    return false;
+
+  // check number of solids containing the face
   ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(theResult, true);
   if (!anOwner) {
     anOwner = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
@@ -47,6 +53,6 @@ bool FiltersPlugin_ExternalFaces::isOk(const GeomShapePtr& theShape,
   TopTools_IndexedDataMapOfShapeListOfShape aMapFS;
   TopExp::MapShapesAndUniqueAncestors(anOwnerShape->impl<TopoDS_Shape>(),
                                       TopAbs_FACE, TopAbs_SOLID, aMapFS);
-  const TopTools_ListOfShape& aSolids = aMapFS.FindFromKey(theShape->impl<TopoDS_Shape>());
+  const TopTools_ListOfShape& aSolids = aMapFS.FindFromKey(aShape);
   return aSolids.Extent() <= 1;
 }