]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2920: Concealment into multi-level Compounds
authorazv <azv@opencascade.com>
Thu, 31 Oct 2019 10:17:01 +0000 (13:17 +0300)
committervsv <vsv@opencascade.com>
Wed, 6 Nov 2019 08:27:41 +0000 (11:27 +0300)
Improve hierarchy of the result.

14 files changed:
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp
src/FeaturesPlugin/Test/Test2920.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCommon_MultiLevelCompound_v20190506_1.py
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_1.py
src/FeaturesPlugin/Test/TestBooleanCut_MultiLevelCompound_v20190506_2.py
src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_1.py
src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_2.py
src/FeaturesPlugin/Test/TestBooleanFuse_MultiLevelCompound_v20190506_4.py
src/FeaturesPlugin/Test/TestBooleanSmash_MultiLevelCompound_v20190506_2.py
src/FeaturesPlugin/Test/TestBooleanSplit_MultiLevelCompound_v20190506_1.py
src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_1.py
src/FeaturesPlugin/Test/TestPartition_MultiLevelCompound_v20190506_3.py
src/FeaturesPlugin/Test/TestUnion_MultiLevelCompound_v20190506.py

index 96b6a1e6eab2000ae0aa2528b581fc3d0f984eb2..2821777627f1d8aa08f2ec1a4e0ca93484058f9b 100644 (file)
@@ -494,6 +494,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                Test2826.py
                Test2854.py
                Test2878.py
+               Test2920.py
                Test2971.py
                Test3014.py
                TestBooleanCommon_MultiLevelCompound_v0_1.py
index ddb04e593acbfaae774eecdcdccfc4b1ccd2c3b5..ea18dd5a9fa50e89dbb0e87d46caec09b0c28faf 100644 (file)
@@ -417,19 +417,12 @@ GeomShapePtr FeaturesPlugin_VersionedBoolean::keepUnusedSubsOfCompound(
 
   GeomShapePtr aResultShape = theResult;
   if (!aCompounds.empty()) {
-    aResultShape = aCompounds.front();
-    aCompounds.pop_front();
-
-    std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder);
-    for (ListOfShape::iterator anIt = aCompounds.begin(); anIt != aCompounds.end(); ++anIt) {
-      for (GeomAPI_ShapeIterator aSub(*anIt); aSub.more(); aSub.next())
-        aBuilder->add(aResultShape, aSub.current());
-    }
-
-    if (theResult)
+    aResultShape = GeomAlgoAPI_CompoundBuilder::compound(aCompounds);
+    if (theResult) {
+      std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder);
       aBuilder->add(aResultShape, theResult);
-
-    theMakeShapeList->appendAlgo(aBuilder);
+      theMakeShapeList->appendAlgo(aBuilder);
+    }
   }
   return aResultShape;
 }
diff --git a/src/FeaturesPlugin/Test/Test2920.py b/src/FeaturesPlugin/Test/Test2920.py
new file mode 100644 (file)
index 0000000..e4d5c40
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright (C) 2019  CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-28.02134146341463, 30.17682926829269, -40.03048780487805, 30.17682926829269)
+SketchLine_2 = Sketch_1.addLine(-40.03048780487805, 30.17682926829269, -40.03048780487805, 21.24695121951219)
+SketchLine_3 = Sketch_1.addLine(-40.03048780487805, 21.24695121951219, -28.02134146341463, 21.24695121951219)
+SketchLine_4 = Sketch_1.addLine(-28.02134146341463, 21.24695121951219, -28.02134146341463, 30.17682926829269)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(-24.32621951219512, 13.39481707317073, -38.79878048780488, 13.39481707317073)
+SketchLine_6 = Sketch_1.addLine(-38.79878048780488, 13.39481707317073, -38.79878048780488, 9.545731707317071)
+SketchLine_7 = Sketch_1.addLine(-38.79878048780488, 9.545731707317071, -24.32621951219512, 9.545731707317071)
+SketchLine_8 = Sketch_1.addLine(-24.32621951219512, 9.545731707317071, -24.32621951219512, 13.39481707317073)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
+SketchCircle_1 = Sketch_1.addCircle(-15.39634146341463, 19.39939024390243, 5.234756097560973)
+Extrusion_1.setNestedSketch(Sketch_1)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 10)
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_2.addEllipse(9.45504630186378, 35.70277888541424, 12.45818659778603, 26.02599348744252, 6.842520574992792)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_9, SketchLine_10] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchLine_11 = Sketch_2.addLine(18.91725801191108, 15.97306085169858, 9.656369955269037, 15.97306085169858)
+SketchLine_12 = Sketch_2.addLine(9.656369955269037, 15.97306085169858, 9.656369955269037, -4.360628142232864)
+SketchLine_13 = Sketch_2.addLine(9.656369955269037, -4.360628142232864, 18.91725801191108, -4.360628142232864)
+SketchLine_14 = Sketch_2.addLine(18.91725801191108, -4.360628142232864, 18.91725801191108, 15.97306085169858)
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
+SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result())
+SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result())
+SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result())
+SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result())
+SketchCircle_2 = Sketch_2.addCircle(-32.8229209132412, -2.146067954774983, 6.582390686251648)
+Extrusion_2.setNestedSketch(Sketch_2)
+Compound_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]
+Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
+Compound_1.result().setName("A")
+Compound_1.result().setColor(0, 255, 0)
+Compound_1.result().subResult(0).setColor(0, 255, 0)
+Compound_1.result().subResult(1).setColor(0, 255, 0)
+Compound_1.result().subResult(2).setColor(0, 255, 0)
+Compound_2_objects = [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+Compound_2.result().setName("B")
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Compound_1_1_1/Modified_Face&Extrusion_1_1/To_Face"), 5, True)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
+SketchLine_15 = Sketch_3.addLine(-43.21451225862969, 24.76425132139253, -23.11145813617009, 27.98073998098607)
+SketchLine_16 = Sketch_3.addLine(-23.11145813617009, 27.98073998098607, 25.13587175773296, 39.84154191323723)
+SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchLine_17 = Sketch_3.addLine(25.13587175773296, 39.84154191323723, 22.9245358042624, 1.746254351176285)
+SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint())
+SketchLine_18 = Sketch_3.addLine(22.9245358042624, 1.746254351176285, -48.84336741291839, 6.973048423015779)
+SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
+SketchLine_19 = Sketch_3.addLine(-48.84336741291839, 6.973048423015779, -43.21451225862969, 24.76425132139253)
+SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
+SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_15.startPoint(), SketchLine_19.endPoint())
+SketchLine_20 = Sketch_3.addLine(-42.51090536434361, 23.45755280343266, -22.9104275949455, 26.1714651099647)
+SketchLine_21 = Sketch_3.addLine(-22.9104275949455, 26.1714651099647, 23.32659688671159, 37.73072123037897)
+SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_22 = Sketch_3.addLine(23.32659688671159, 37.73072123037897, 20.91423039201644, 3.957590304646839)
+SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_3.addLine(20.91423039201644, 3.957590304646839, -46.02893983577404, 7.97820112913876)
+SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_3.addLine(-46.02893983577404, 7.97820112913876, -42.51090536434361, 23.45755280343266)
+SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint())
+SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.endPoint())
+model.do()
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_18r-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_20f-SketchLine_21f-SketchLine_22f-SketchLine_23f-SketchLine_24f")], model.selection(), 10, 0)
+Extrusion_3.result().setName("C")
+Extrusion_3.result().setColor(0, 85, 255)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1"), model.selection("SOLID", "Compound_2_1_2")], [model.selection("SOLID", "C")], 20190506)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [4])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [6])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [35])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [138])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [276])
+model.testResultsVolumes(Cut_1, [14047.4641487433])
+
+assert(model.checkPythonDump())
index ddbbf6fa5e4b3b4dd8e8fae086c5e8509b689ab5..d23996c4ce58729ebec99bc0172c1737c11c1fe4 100644 (file)
@@ -86,7 +86,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Common_1, 1)
-model.testNbSubResults(Common_1, [4])
+model.testNbSubResults(Common_1, [3])
 model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [7])
 model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [34])
 model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [120])
index 0729e5bb0044b886be8e46e7fe36b4dace80e5b1..f46bd8579a3a0f7b907f2ffe2e8e97df569ad8cf 100644 (file)
@@ -53,7 +53,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Cut_1, 1)
-model.testNbSubResults(Cut_1, [3])
+model.testNbSubResults(Cut_1, [2])
 model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [4])
 model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [14])
 model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [30])
index 7c9432f9fc1c953778d02a39778b53dca4987289..242bc6f0796f7bbcb04bd40384b5a586b86e2f52 100644 (file)
@@ -111,7 +111,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Cut_1, 1)
-model.testNbSubResults(Cut_1, [5])
+model.testNbSubResults(Cut_1, [4])
 model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [7])
 model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [43])
 model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [182])
index 42b7fa94bf01c2b5861b8c0a7bac4588e350011a..5cb60f3daea99b7152a75bd54eda552ab5bb4de3 100644 (file)
@@ -87,7 +87,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Fuse_1, 1)
-model.testNbSubResults(Fuse_1, [4])
+model.testNbSubResults(Fuse_1, [3])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [5])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [50])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [208])
index 7cb0da09deb601113da5a4d243ab092ee258b8e6..25eb78b79e4d65ec85ee6cf9cccc8caa068a6503 100644 (file)
@@ -85,7 +85,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Fuse_1, 1)
-model.testNbSubResults(Fuse_1, [3])
+model.testNbSubResults(Fuse_1, [2])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [6])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [23])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [70])
index 6452a7c60808f41c12129d99d6cef3a50a9a1aa0..996bb2ad35a1c7afe7ce3238f262594d250f3db6 100644 (file)
@@ -84,7 +84,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Fuse_1, 1)
-model.testNbSubResults(Fuse_1, [4])
+model.testNbSubResults(Fuse_1, [3])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [7])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [32])
 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [94])
index 5bb3790e676ad0c9a6e2680b3243342ff4e1adb6..d7b2d5607ab50216b280fc569a42c21cace5cb8a 100644 (file)
@@ -111,7 +111,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Smash_1, 1)
-model.testNbSubResults(Smash_1, [3])
+model.testNbSubResults(Smash_1, [2])
 model.testNbSubShapes(Smash_1, GeomAPI_Shape.SOLID, [9])
 model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [83])
 model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [376])
index 68c0cff7acb22aada5eaf7a7f083d30e20de2a77..f768b45a36e567ac134ba1437c0533441b73838d 100644 (file)
@@ -86,7 +86,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Split_1, 1)
-model.testNbSubResults(Split_1, [4])
+model.testNbSubResults(Split_1, [3])
 model.testNbSubShapes(Split_1, GeomAPI_Shape.SOLID, [11])
 model.testNbSubShapes(Split_1, GeomAPI_Shape.FACE, [73])
 model.testNbSubShapes(Split_1, GeomAPI_Shape.EDGE, [292])
index de14905ba9c2693df8dc5c30189b3bf4989109aa..b0bd23d047506bec2444dcfd1f86fe9dabbc9bfd 100644 (file)
@@ -86,7 +86,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Partition_1, 1)
-model.testNbSubResults(Partition_1, [4])
+model.testNbSubResults(Partition_1, [3])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [15])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [98])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [394])
index 0007bd6bb1c1ecb97201b8e4ee1241a32812928c..0354f62521e3361821708684a0d443e3c074a771 100644 (file)
@@ -83,7 +83,7 @@ Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects, 20190506)
 model.do()
 
 model.testNbResults(Partition_1, 1)
-model.testNbSubResults(Partition_1, [6])
+model.testNbSubResults(Partition_1, [4])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [12])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [70])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [276])
@@ -100,7 +100,7 @@ model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc)
 model.end()
 
 model.testNbResults(Partition_1, 1)
-model.testNbSubResults(Partition_1, [6])
+model.testNbSubResults(Partition_1, [4])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [10])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [52])
 model.testNbSubShapes(Partition_1, GeomAPI_Shape.EDGE, [192])
index 63d3e03cbfe8c3cd6e3807f21032f3335cd38ac2..3e2469c59770c79119decfb71d027c117686ab70 100644 (file)
@@ -77,7 +77,7 @@ model.end()
 from GeomAPI import GeomAPI_Shape
 
 model.testNbResults(Union_1, 1)
-model.testNbSubResults(Union_1, [9])
+model.testNbSubResults(Union_1, [2])
 model.testNbSubShapes(Union_1, GeomAPI_Shape.SOLID, [15])
 model.testNbSubShapes(Union_1, GeomAPI_Shape.FACE, [70])
 model.testNbSubShapes(Union_1, GeomAPI_Shape.EDGE, [224])