Salome HOME
SketchSolver Refactoring: Eliminate SolveSpace as a sketch solver.
[modules/shaper.git] / src / SketchPlugin / Test / Test1061.py
1 """
2     Test1061.py
3     Test case for issue #1061 "Distance constraint using for points with equal coordinates"
4 """
5
6 import math
7 from salome.shaper import model
8
9 model.begin()
10 partSet = model.moduleDocument()
11 Part_1 = model.addPart(partSet)
12 Part_1_doc = Part_1.document()
13
14 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
15 SketchLine_1 = Sketch_1.addLine(70, 120, 50, 25)
16 SketchLine_2 = Sketch_1.addLine(50, 25, 170, 50)
17
18 DISTANCE = 100
19 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_2.startPoint(), DISTANCE)
20 model.do()
21
22 # check distance between points
23 aDist2 = (SketchLine_1.endPoint().x() - SketchLine_2.startPoint().x())**2 + (SketchLine_1.endPoint().y() - SketchLine_2.startPoint().y())**2
24 assert(math.fabs(aDist2 - DISTANCE**2) > 1e-12)
25
26 model.end()
27
28 assert(model.checkPythonDump())