Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchPlugin / Test / Test2034_3.py
1 # Copyright (C) 2018-2023  CEA, EDF
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_3.py
22     Test case for issue #2034 "Conflicting constraint not raised (but found by planegcs and shaper's dof computation)"
23 """
24
25 from SketchAPI import *
26
27 from salome.shaper import model
28
29 model.begin()
30 partSet = model.moduleDocument()
31 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOZ"))
32 SketchLine_1 = Sketch_1.addLine(5, 0, 0, 5)
33 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False)
34 SketchLine_2 = SketchProjection_1.createdFeature()
35 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
36 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OZ"), False)
37 SketchLine_3 = SketchProjection_2.createdFeature()
38 SketchLine_4 = Sketch_1.addLine(0, 5, -5, 0)
39 SketchLine_5 = Sketch_1.addLine(-5, 0, 5, 0)
40 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
41 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_2.result())
42 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint())
43 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
44 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result())
45 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint())
46 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result())
47 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 10)
48 model.do()
49 Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
50 SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), False)
51 SketchPoint_1 = SketchProjection_3.createdFeature()
52 SketchArc_1 = Sketch_2.addArc(0, 5, -5, 0, 5, 0, False)
53 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_1.startPoint())
54 SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
55 SketchPoint_2 = SketchProjection_4.createdFeature()
56 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
57 SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
58 SketchPoint_3 = SketchProjection_5.createdFeature()
59 model.do()
60
61 # check sketch is correct
62 assert(Sketch_2.solverError().value() == "")
63
64 # add coincidence between center of arc and a point from the first sketch
65 Sketch_2.setCoincident(SketchArc_1.center(), SketchAPI_Point(SketchPoint_3).coordinates())
66 model.do()
67 assert(Sketch_2.solverError().value() != "")
68
69 model.end()