From: dbv Date: Fri, 2 Nov 2018 08:23:50 +0000 (+0300) Subject: Issue #2692: Extrusion-cut doesn't work when I select a compound X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f31c067101883f45070b5aea0edf79d4882c744d;p=modules%2Fshaper.git Issue #2692: Extrusion-cut doesn't work when I select a compound Fixed extrusion cut on compounds. --- diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index b088c904a..9ab857eef 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -385,4 +385,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2698.py Test2701.py Test2724.py + Test2692.py ) diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index 670dbe02a..6e3e8796b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include @@ -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 index 000000000..ac516381b --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2692.py @@ -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])