Salome HOME
Issue #2920: Concealment into multi-level Compounds
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_VersionedBoolean.cpp
index ddb04e593acbfaae774eecdcdccfc4b1ccd2c3b5..ea18dd5a9fa50e89dbb0e87d46caec09b0c28faf 100644 (file)
@@ -417,19 +417,12 @@ GeomShapePtr FeaturesPlugin_VersionedBoolean::keepUnusedSubsOfCompound(
 
   GeomShapePtr aResultShape = theResult;
   if (!aCompounds.empty()) {
-    aResultShape = aCompounds.front();
-    aCompounds.pop_front();
-
-    std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder);
-    for (ListOfShape::iterator anIt = aCompounds.begin(); anIt != aCompounds.end(); ++anIt) {
-      for (GeomAPI_ShapeIterator aSub(*anIt); aSub.more(); aSub.next())
-        aBuilder->add(aResultShape, aSub.current());
-    }
-
-    if (theResult)
+    aResultShape = GeomAlgoAPI_CompoundBuilder::compound(aCompounds);
+    if (theResult) {
+      std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder);
       aBuilder->add(aResultShape, theResult);
-
-    theMakeShapeList->appendAlgo(aBuilder);
+      theMakeShapeList->appendAlgo(aBuilder);
+    }
   }
   return aResultShape;
 }