Salome HOME
Do not glue empty compounds
[modules/geom.git] / src / GEOMImpl / GEOMImpl_BooleanDriver.cxx
index 4bf020b613f61545549e1b0ab13f0ea254538eaa..c419cd6d5f93adbc78297384662cad6e3a0c762f 100644 (file)
@@ -153,6 +153,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
       }
 
       if (isCompound) {
+        /*
         TopTools_ListOfShape listShapeC;
         AddSimpleShapes(C, listShapeC);
         TopTools_ListIteratorOfListOfShape itSubC (listShapeC);
@@ -165,6 +166,14 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
           aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion());
         else
           aShape = C;
+        */
+
+        // As GlueFaces has been improved to keep all kind of shapes
+        TopExp_Explorer anExp (C, TopAbs_VERTEX);
+        if (anExp.More())
+          aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
+        else
+          aShape = C;
       }
     }
 
@@ -215,6 +224,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
       }
 
       if (isCompound) {
+        /*
         TopTools_ListOfShape listShapeC;
         AddSimpleShapes(C, listShapeC);
         TopTools_ListIteratorOfListOfShape itSubC (listShapeC);
@@ -227,11 +237,20 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
           aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion());
         else
           aShape = C;
+        */
+
+        // As GlueFaces has been improved to keep all kind of shapes
+        TopExp_Explorer anExp (C, TopAbs_VERTEX);
+        if (anExp.More())
+          aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
+        else
+          aShape = C;
       }
     }
 
     // perform FUSE operation
     else if (aType == BOOLEAN_FUSE) {
+      /* Fix for NPAL15379: refused
       // Check arguments
       TopTools_ListOfShape listShape1, listShape2;
       AddSimpleShapes(aShape1, listShape1);
@@ -305,6 +324,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
           }
         }
       }
+      */
 
       // Perform
       BRepAlgoAPI_Fuse BO (aShape1, aShape2);
@@ -367,8 +387,16 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
         }
       }
 
-      if (isCompound)
-        aShape = C;
+      if (isCompound) {
+        //aShape = C;
+
+        // As GlueFaces has been improved to keep all kind of shapes
+        TopExp_Explorer anExp (C, TopAbs_VERTEX);
+        if (anExp.More())
+          aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
+        else
+          aShape = C;
+      }
     }
 
     // UNKNOWN operation