From 6c3bd8c81fd53eebba1aa6bffcf27dc1abcee9e7 Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 22 Jan 2018 15:20:19 +0300 Subject: [PATCH] Issue #2409: Filling on one edge Add validator for number of edges selected by the Filling --- src/BuildPlugin/Test/Test2409.py | 64 ++++++++++++++++++++++++++++++ src/BuildPlugin/filling_widget.xml | 1 + 2 files changed, 65 insertions(+) create mode 100644 src/BuildPlugin/Test/Test2409.py diff --git a/src/BuildPlugin/Test/Test2409.py b/src/BuildPlugin/Test/Test2409.py new file mode 100644 index 000000000..2056fd386 --- /dev/null +++ b/src/BuildPlugin/Test/Test2409.py @@ -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 +## + +""" + 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()) diff --git a/src/BuildPlugin/filling_widget.xml b/src/BuildPlugin/filling_widget.xml index 0ecb85877..118136897 100644 --- a/src/BuildPlugin/filling_widget.xml +++ b/src/BuildPlugin/filling_widget.xml @@ -45,4 +45,5 @@ email : webmaster.salome@opencascade.com + -- 2.39.2