Salome HOME
Fix Warning in NewGeom_Module.cpp
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Extrusion.cpp
index 09e3e3c14af4497b24338043ca264381b9711c04..c8ac130c44e0f33c8d7fe49615b8ccc3aa3d156c 100644 (file)
@@ -86,7 +86,9 @@ void FeaturesPlugin_Extrusion::execute()
     for(int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; aFaceIndex++) {
       std::shared_ptr<GeomAPI_Shape> aBaseShape;
       if (aFacesNum == -1) {
-        aFacesList.push_back(aFaceShape);
+        if (!aFaceShape->isNull()) {
+          aFacesList.push_back(aFaceShape);
+        }
         break;
       } else {
         aFaceShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
@@ -133,11 +135,7 @@ void FeaturesPlugin_Extrusion::execute()
   ListOfShape aFreeFaces;
   std::shared_ptr<GeomAPI_Shape> aFacesCompound = GeomAlgoAPI_CompoundBuilder::compound(aFacesList);
   GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL, aShells, aFreeFaces);
-  if(aShells.empty()) {
-    aShells = aFreeFaces;
-  } else {
-    aShells.merge(aFreeFaces);
-  }
+  aShells.insert(aShells.end(), aFreeFaces.begin(), aFreeFaces.end());
 
   // Generating result for each shell and face.
   int aResultIndex = 0;
@@ -192,25 +190,25 @@ void FeaturesPlugin_Extrusion::loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
 
   //Insert to faces
   const std::string aToName = "ToFace";
-  const int aToTag = 2;
+  int aToTag = 2;
   const ListOfShape& aToFaces = thePrismAlgo.toFaces();
   for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
     std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
     if(aSubShapes->isBound(aToFace)) {
       aToFace = aSubShapes->find(aToFace);
     }
-    theResultBody->generated(aToFace, aToName, aToTag);
+    theResultBody->generated(aToFace, aToName, aToTag++);
   }
 
   //Insert from faces
   const std::string aFromName = "FromFace";
-  const int aFromTag = 3;
+  int aFromTag = aToTag > 10000 ? aToTag : 10000;
   const ListOfShape& aFromFaces = thePrismAlgo.fromFaces();
   for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
     std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
     if(aSubShapes->isBound(aFromFace)) {
       aFromFace = aSubShapes->find(aFromFace);
     }
-    theResultBody->generated(aFromFace, aFromName, aFromTag);
+    theResultBody->generated(aFromFace, aFromName, aFromTag++);
   }
 }