]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3014: Partition fails
authorazv <azv@opencascade.com>
Thu, 3 Oct 2019 12:47:51 +0000 (15:47 +0300)
committerazv <azv@opencascade.com>
Thu, 3 Oct 2019 12:47:51 +0000 (15:47 +0300)
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Partition.cpp
src/FeaturesPlugin/Test/Test3014.py [new file with mode: 0644]

index 74564bde1f6928072ad20bd5b1a70aebec508cdd..7640e539aea9caa8e33620dc08b0c9e542ad577a 100644 (file)
@@ -489,6 +489,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                Test2854.py
                Test2878.py
                Test2971.py
+               Test3014.py
                TestBooleanCommon_MultiLevelCompound_v0_1.py
                TestBooleanCommon_MultiLevelCompound_v0_2.py
                TestBooleanCommon_MultiLevelCompound_v20190506_1.py
index 96052010d10e07f7489cfdfa4bd6de18a4888a5c..48c7141a2cd1a7908b397199e71352730189a27a 100644 (file)
@@ -153,6 +153,12 @@ void FeaturesPlugin_Partition::execute()
       keepUnusedSubsOfCompound(aFirstShape, anObjects, ObjectHierarchy(), aMakeShapeList);
 
     if (anIt.more()) {
+      if (aResultCompound->shapeType() != GeomAPI_Shape::COMPOUND) {
+        // put the shape into compound
+        ListOfShape aShapes;
+        aShapes.push_back(aResultCompound);
+        aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
+      }
       std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder);
       for (; anIt.more(); anIt.next())
         aBuilder->add(aResultCompound, anIt.current());
diff --git a/src/FeaturesPlugin/Test/Test3014.py b/src/FeaturesPlugin/Test/Test3014.py
new file mode 100644 (file)
index 0000000..711b12e
--- /dev/null
@@ -0,0 +1,50 @@
+# 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 GeomAPI import *
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "nb", "10")
+model.addParameter(Part_1_doc, "h", "20")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(0, 55.86212361331221, 9.333219356250011)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchCircle_1.results()[1]], SketchAPI_Line(SketchLine_1).startPoint(), 360, "nb", True)
+[SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8, SketchCircle_9, SketchCircle_10] = SketchMultiRotation_1.rotated()
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), "h", 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_4/To_Face"), "h/2", True)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPOUND", "all-in-Extrusion_1")], 20190506)
+model.end()
+
+assert(Partition_1.feature().error() == "")
+
+model.testNbResults(Partition_1, 1)
+model.testNbSubResults(Partition_1, [10])
+model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [20])
+
+assert(model.checkPythonDump())