]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1915: boolean failed
authordbv <dbv@opencascade.com>
Wed, 1 Feb 2017 13:49:21 +0000 (16:49 +0300)
committerdbv <dbv@opencascade.com>
Wed, 1 Feb 2017 13:55:21 +0000 (16:55 +0300)
Fixed PaveFiller error.

src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/Test/Test1915.py [new file with mode: 0644]

index 8fa040447c0a0882ddbdf66f32f9069a51839f5a..cf821fd9e051dc28768f43fdee83e6298cfbacc9 100644 (file)
@@ -142,4 +142,5 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestRecover1798.py
                Test1922.py
                Test1942.py
+               Test1915.py
 )
index d265fb37cff4e1239d63b3f44dfc2223eaeb2e32..f3941ec119ccd981fffc79b2dd5907f6e1cf786f 100644 (file)
@@ -271,26 +271,29 @@ void FeaturesPlugin_Boolean::execute()
         aMakeShapeList.appendAlgo(aBoolAlgo);
         GeomAPI_DataMapOfShapeShape aMapOfShapes;
         aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
+        GeomShapePtr aResultShape = aBoolAlgo->shape();
 
         // 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 = "Error: PaveFiller algorithm failed.";
-          setError(aFeatureError);
-          return;
-        }
+        if(!aNotUsedSolids.empty()) {
+          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 = "Error: PaveFiller algorithm failed.";
+            setError(aFeatureError);
+            return;
+          }
 
-        aMakeShapeList.appendAlgo(aFillerAlgo);
-        aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+          aMakeShapeList.appendAlgo(aFillerAlgo);
+          aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+          aResultShape = aFillerAlgo->shape();
+        }
 
-        if(GeomAlgoAPI_ShapeTools::volume(aFillerAlgo->shape()) > 1.e-27) {
+        if(GeomAlgoAPI_ShapeTools::volume(aResultShape) > 1.e-27) {
           std::shared_ptr<ModelAPI_ResultBody> aResultBody =
             document()->createBody(data(), aResultIndex);
-          loadNamingDS(aResultBody, aCompSolid, aTools,
-                       aFillerAlgo->shape(), aMakeShapeList, aMapOfShapes);
+          loadNamingDS(aResultBody, aCompSolid, aTools, aResultShape, aMakeShapeList, aMapOfShapes);
           setResult(aResultBody, aResultIndex);
           aResultIndex++;
         }
diff --git a/src/FeaturesPlugin/Test/Test1915.py b/src/FeaturesPlugin/Test/Test1915.py
new file mode 100644 (file)
index 0000000..0030af0
--- /dev/null
@@ -0,0 +1,19 @@
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-143.8658546926619, 0.1897622851492952, 114.0641755357124)
+SketchLine_1 = Sketch_1.addLine(-141.3317208711381, 114.2257842537203, -143.8607239569611, -118.2013550640528)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(-111.0503834053735, -148.4878232655183, 89.21253106334201)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0)
+Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
+model.end()
+
+assert(model.checkPythonDump())