Salome HOME
Fixed validators for Boolean and Intersection
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Partition.cpp
index 55455220c3f2ecc2120d056c719c777e581fd56c..06849b9f17eb42f2debdbb3f7297a674e339b9a8 100644 (file)
@@ -66,34 +66,15 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects,
   TopoDS_Shape aResult = anOperation->Shape();
 
   if(aResult.ShapeType() == TopAbs_COMPOUND) {
-    aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
-  }
-  if(aResult.ShapeType() == TopAbs_COMPOUND) {
-    std::shared_ptr<GeomAPI_Shape> aCompound(new GeomAPI_Shape);
-    aCompound->setImpl(new TopoDS_Shape(aResult));
-    ListOfShape aCompSolids, aFreeSolids;
-    GeomAlgoAPI_ShapeTools::combineShapes(aCompound, GeomAPI_Shape::COMPSOLID, aCompSolids, aFreeSolids);
-    if(aCompSolids.size() == 1 && aFreeSolids.size() == 0) {
-      aResult = aCompSolids.front()->impl<TopoDS_Shape>();
-    } else if (aCompSolids.size() > 1 || (aCompSolids.size() >= 1 && aFreeSolids.size() >= 1)) {
-      TopoDS_Compound aResultComp;
-      TopoDS_Builder aBuilder;
-      aBuilder.MakeCompound(aResultComp);
-      for(ListOfShape::const_iterator anIter = aCompSolids.cbegin(); anIter != aCompSolids.cend(); anIter++) {
-        aBuilder.Add(aResultComp, (*anIter)->impl<TopoDS_Shape>());
-      }
-      for(ListOfShape::const_iterator anIter = aFreeSolids.cbegin(); anIter != aFreeSolids.cend(); anIter++) {
-        aBuilder.Add(aResultComp, (*anIter)->impl<TopoDS_Shape>());
-      }
-      aResult = aResultComp;
-    }
+    std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
+    aGeomShape->setImpl(new TopoDS_Shape(aResult));
+    aResult = GeomAlgoAPI_ShapeTools::groupSharedTopology(aGeomShape)->impl<TopoDS_Shape>();
   }
 
   // Setting result.
   if(aResult.IsNull()) {
     return;
   }
-  aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
   std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
   aShape->setImpl(new TopoDS_Shape(aResult));
   this->setShape(aShape);