+ loadNamingDS(aResultBody, aShells, aSolidsAlgos, anObject, aTools, aBoolAlgo.shape(),
+ aBoolAlgo, *aBoolAlgo.mapOfSubShapes().get());
+ setResult(aResultBody, aResultIndex);
+ aResultIndex++;
+ }
+ }
+
+ // Compsolids handling
+ for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator anIt = aCompSolidsObjects.begin();
+ anIt != aCompSolidsObjects.end(); anIt++) {
+ std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
+ ListOfShape& aUsedInOperationSolids = anIt->second;
+
+ // Collecting solids from compsolids which will not be modified in boolean operation.
+ ListOfShape aNotUsedSolids;
+ for(GeomAPI_ShapeExplorer anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
+ std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
+ ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
+ for(; anIt != aUsedInOperationSolids.end(); anIt++) {
+ if(aSolidInCompSolid->isEqual(*anIt)) {
+ break;
+ }
+ }
+ if(anIt == aUsedInOperationSolids.end()) {
+ aNotUsedSolids.push_back(aSolidInCompSolid);
+ }
+ }
+
+ std::shared_ptr<GeomAlgoAPI_Boolean> aBoolAlgo(new GeomAlgoAPI_Boolean(aUsedInOperationSolids, aTools, myBooleanOperationType));
+
+ // Checking that the algorithm worked properly.
+ if(!aBoolAlgo->isDone() || aBoolAlgo->shape()->isNull() || !aBoolAlgo->isValid()) {
+ setError("Boolean algorithm failed");
+ return;
+ }
+
+ GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ aMakeShapeList.appendAlgo(aBoolAlgo);
+ GeomAPI_DataMapOfShapeShape aMapOfShapes;
+ aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
+
+ // Add result to not used solids from compsolid.
+ ListOfShape aShapesToAdd = aNotUsedSolids;
+ aShapesToAdd.push_back(aBoolAlgo->shape());
+ std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
+ if(!aFillerAlgo->isDone()) {
+ std::string aFeatureError = "PaveFiller algorithm failed";
+ setError(aFeatureError);
+ return;
+ }
+
+ aMakeShapeList.appendAlgo(aFillerAlgo);
+ aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+
+ if(GeomAlgoAPI_ShapeTools::volume(aFillerAlgo->shape()) > 1.e-7) {
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
+ loadNamingDS(aResultBody, aShells, aSolidsAlgos, aCompSolid, aTools, aFillerAlgo->shape(), aMakeShapeList, aMapOfShapes);