]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2409: Filling on one edge
authorazv <azv@opencascade.com>
Mon, 22 Jan 2018 12:20:19 +0000 (15:20 +0300)
committerazv <azv@opencascade.com>
Mon, 22 Jan 2018 12:20:19 +0000 (15:20 +0300)
Add validator for number of edges selected by the Filling

src/BuildPlugin/Test/Test2409.py [new file with mode: 0644]
src/BuildPlugin/filling_widget.xml

diff --git a/src/BuildPlugin/Test/Test2409.py b/src/BuildPlugin/Test/Test2409.py
new file mode 100644 (file)
index 0000000..2056fd3
--- /dev/null
@@ -0,0 +1,64 @@
+## Copyright (C) 2018-20xx  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<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+    Issue #2409: Filling on one edge
+    Check the Filling reports error if just one edge is selected
+"""
+
+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"))
+SketchLine_1 = Sketch_1.addLine(80, 10, 10, 10)
+SketchLine_2 = Sketch_1.addLine(10, 10, 10, 60)
+SketchLine_3 = Sketch_1.addLine(10, 60, 80, 60)
+SketchLine_4 = Sketch_1.addLine(80, 60, 80, 10)
+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())
+model.do()
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+model.do()
+# check error is reported
+assert(Filling_1.feature().error() != "")
+
+Filling_1.setBase([model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
+model.do()
+# check there is no error
+assert(Filling_1.feature().error() == "")
+
+from GeomAPI import GeomAPI_Shape
+model.testNbResults(Filling_1, 1)
+model.testNbSubShapes(Filling_1, GeomAPI_Shape.FACE, [1])
+model.testResultsVolumes(Filling_1, [3500])
+
+model.end()
+
+assert(model.checkPythonDump())
index 0ecb8587743c247b182d2eeeb736285cf397e382..11813689796ea1fe33e08c0be1f1bfd9044feb12 100644 (file)
@@ -45,4 +45,5 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     <doublevalue id="tol_3d" label="Tol 3D" min="0" default="0.0001" step="0.0001"/>
     <boolvalue id="approximation" label="Approximation"/>
   </optionalbox>
+  <validator id="GeomValidators_MinObjectsSelected" parameters="base_objects,2"/>
 </source>