X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Boolean.cpp;h=21458a9ce2ab14459e803371484d2342e0b391c5;hb=f0cec241aae9ca16d86e166f45cb5c4987d2c792;hp=5322a17e574f2cda35773de03e882ea21fb734c7;hpb=4a63ac1b481fbddea2f240d067c52e51db17c1db;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index 5322a17e5..21458a9ce 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -7,11 +7,9 @@ #include "GeomAlgoAPI_Boolean.h" #include +#include -#include -#include -#include -#include +#include #include //================================================================================================= @@ -47,39 +45,49 @@ void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, } // Creating boolean operation. - BRepAlgoAPI_BooleanOperation* anOperation; + BOPAlgo_BOP* aBuilder = new BOPAlgo_BOP(); switch (theOperationType) { case BOOL_CUT: { - anOperation = new BRepAlgoAPI_Cut(); + aBuilder->SetOperation(BOPAlgo_CUT); break; } case BOOL_FUSE: { - anOperation = new BRepAlgoAPI_Fuse(); + aBuilder->SetOperation(BOPAlgo_FUSE); break; } case BOOL_COMMON: { - anOperation = new BRepAlgoAPI_Common(); + aBuilder->SetOperation(BOPAlgo_COMMON); break; } default: { return; } } - this->setImpl(anOperation); - this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - anOperation->SetArguments(anObjects); - anOperation->SetTools(aTools); + this->setImpl(aBuilder); + this->setBuilderType(OCCT_BOPAlgo_Builder); + aBuilder->SetArguments(anObjects); + aBuilder->SetTools(aTools); // Building and getting result. - anOperation->Build(); - if(anOperation->IsDone() != Standard_True) { + aBuilder->Perform(); + if(aBuilder->ErrorStatus() != 0) { return; } - TopoDS_Shape aResult = anOperation->Shape(); + TopoDS_Shape aResult = aBuilder->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); } + if(aResult.ShapeType() == TopAbs_COMPOUND) { + std::shared_ptr aGeomShape(new GeomAPI_Shape); + aGeomShape->setImpl(new TopoDS_Shape(aResult)); + ListOfShape aCompSolids, aFreeSolids; + aGeomShape = GeomAlgoAPI_ShapeTools::combineShapes(aGeomShape, + GeomAPI_Shape::COMPSOLID, + aCompSolids, + aFreeSolids); + aResult = aGeomShape->impl(); + } std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult));