]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/BuildPlugin/BuildPlugin_Face.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Face.cpp
index a840fd5de7832034fab1663cd6696a40d13ab70d..ba39fe3be77c9a37a81f2ffa9fcf8282eb061aa5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BuildPlugin_Face.h"
 
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultConstruction.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_PlanarEdges.h>
@@ -72,11 +72,21 @@ void BuildPlugin_Face::execute()
     if(!aShape.get()) {
       aShape = aContext;
     }
-    // keep selected faces "as is"
     if (aShape->shapeType() == GeomAPI_Shape::FACE) {
+      // keep selected faces "as is"
       anOriginalFaces.push_back(aShape);
       continue;
     }
+    else if (!aSelection->value() && aShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+      // collect faces from the sketch
+      ResultConstructionPtr aSketch =
+          std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSelection->context());
+      if (aSketch && aSketch->facesNum() > 0) {
+        for (int i = 0; i < aSketch->facesNum(); ++i)
+          anOriginalFaces.push_back(aSketch->face(i));
+        continue;
+      }
+    }
 
     for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
       GeomShapePtr anEdge = anExp.current();
@@ -112,7 +122,10 @@ void BuildPlugin_Face::execute()
     aMakeShapeList->appendAlgo(aCopy);
 
     ListOfShape aBaseShapes;
-    aBaseShapes.push_back(aShape);
+    if (anIndex < aNbFacesFromEdges)
+      aBaseShapes = anEdges;
+    else
+      aBaseShapes.push_back(aShape);
     storeResult(aMakeShapeList, aBaseShapes, aContexts, aCopy->shape(), anIndex++);
   }