Salome HOME
Issue #2692: Extrusion-cut doesn't work when I select a compound
authordbv <dbv@opencascade.com>
Fri, 2 Nov 2018 08:23:50 +0000 (11:23 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
Fixed extrusion cut on compounds.

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

index b088c904a3c496048d925ea4dd1b18c6a32544f7..9ab857eef8701ba095c05e94f27d12e0b75035d2 100644 (file)
@@ -385,4 +385,5 @@ ADD_UNIT_TESTS(TestExtrusion.py
                Test2698.py
                Test2701.py
                Test2724.py
+               Test2692.py
 )
index 670dbe02a845e6f2768217bd3dbceb02ebad399b..6e3e8796b16493de7e94cbdb991ef587f26db77d 100644 (file)
@@ -29,7 +29,7 @@
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
-#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
 
 #include <map>
 
@@ -196,9 +196,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
 
         // Collecting solids from compsolids which will not be modified in boolean operation.
         ListOfShape aShapesToAdd;
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          GeomShapePtr aSolidInCompSolid = anExp.current();
+        for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+             aCompSolidIt.more();
+             aCompSolidIt.next())
+        {
+          GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
           ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin();
           for(; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) {
             if(aSolidInCompSolid->isEqual(*aUsedShapesIt)) {
@@ -279,9 +281,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools,
         aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end());
 
         // Collect solids from compsolid which will not be modified in boolean operation.
-        for(GeomAPI_ShapeExplorer
-            anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
-          GeomShapePtr aSolidInCompSolid = anExp.current();
+        for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+             aCompSolidIt.more();
+             aCompSolidIt.next())
+        {
+          GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
           ListOfShape::iterator anIt = aUsedShapes.begin();
           for(; anIt != aUsedShapes.end(); anIt++) {
             if(aSolidInCompSolid->isEqual(*anIt)) {
diff --git a/src/FeaturesPlugin/Test/Test2692.py b/src/FeaturesPlugin/Test/Test2692.py
new file mode 100644 (file)
index 0000000..ac51638
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 3)
+ExtrusionCut_1_objects_2 = [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_1_1_3")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, ExtrusionCut_1_objects_2)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(4.871972805908816, 24.69028692663239, 2.754280056405151)
+SketchCircle_2 = Sketch_1.addCircle(4.956613458332676, 4.459837610261877, 1.82794741094275)
+SketchCircle_3 = Sketch_1.addCircle(4.842959508111481, 44.32940059836771, 3.136980464700132)
+ExtrusionCut_1.setNestedSketch(Sketch_1)
+model.do()
+model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(ExtrusionCut_1, 1)
+model.testNbSubResults(ExtrusionCut_1, [3])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [21])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(ExtrusionCut_1, [2347.550996571865198347950354218])