+ loadNamingDS(aResultBody, aShells, aSolidsAlgos, anObject, aTools, aBoolAlgo.shape(),
+ *aBoolAlgo.makeShape(), *aBoolAlgo.mapOfShapes());
+ 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);
+ }
+ }
+
+ GeomAlgoAPI_Boolean aBoolAlgo(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.append(aBoolAlgo.makeShape());
+ GeomAPI_DataMapOfShapeShape aMapOfShapes;
+ aMapOfShapes.merge(aBoolAlgo.mapOfShapes());
+
+ // Add result to not used solids from compsolid.
+ ListOfShape aShapesToAdd = aNotUsedSolids;
+ aShapesToAdd.push_back(aBoolAlgo.shape());
+ GeomAlgoAPI_PaveFiller aFillerAlgo(aShapesToAdd, true);
+ if(!aFillerAlgo.isDone()) {
+ std::string aFeatureError = "PaveFiller algorithm failed";
+ setError(aFeatureError);
+ return;
+ }
+
+ aMakeShapeList.append(aFillerAlgo.makeShape());
+ aMapOfShapes.merge(aFillerAlgo.mapOfShapes());
+
+ 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);