Salome HOME
Update copyrights
[modules/shaper.git] / src / SketchPlugin / Test / Test2034_2.py
1 # Copyright (C) 2018-2019  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 """
21     Test2034_2.py
22     Test case for issue #2034 "Conflicting constraint not raised (but found by planegcs and shaper's dof computation)"
23 """
24
25 from salome.shaper import model
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
30 SketchCircle_1 = Sketch_1.addCircle(2.537917624456907, 8.497392663945117, 15)
31 SketchLine_1 = Sketch_1.addLine(-12.22290362866818, 11.16537990805196, 2.537924341198721, 8.497429825311462)
32 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
33 SketchLine_2 = Sketch_1.addLine(2.537924341198721, 8.497429825311462, 17.29875231106562, 5.829479742570965)
34 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
35 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
36 SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result())
37 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result())
38 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 15)
39 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 15)
40 model.do()
41
42 # check sketch is correct
43 assert(Sketch_1.solverError().value() == "")
44
45 # add coincidence between center of circle and the end point of line
46 Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.endPoint())
47 model.do()
48 assert(Sketch_1.solverError().value() != "")
49
50
51 model.end()