From df2c0c1d95fab19d117a64046f1f78844c35dad6 Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 18 Dec 2015 15:32:31 +0300 Subject: [PATCH] [PythonAPI] Rename startPointData()/endPointData() to startPoint()/endPoint() --- src/PythonAPI/Test/TestSketcherSetAngle.py | 16 ++++++------ .../Test/TestSketcherSetCoincident.py | 6 ++--- src/PythonAPI/Test/TestSketcherSetEqual.py | 8 +++--- src/PythonAPI/Test/TestSketcherSetFillet.py | 2 +- .../Test/TestSketcherSetHorizontal.py | 2 +- src/PythonAPI/Test/TestSketcherSetLength.py | 4 +-- .../Test/TestSketcherSetPerpendicular.py | 8 +++--- src/PythonAPI/Test/TestSketcherSetTangent.py | 2 +- src/PythonAPI/Test/TestSketcherSetVertical.py | 2 +- src/PythonAPI/examples/MakeBrick1.py | 10 +++---- src/PythonAPI/examples/MakeBrick2.py | 2 +- src/PythonAPI/examples/Platine.py | 26 +++++++++---------- src/PythonAPI/model/sketcher/line.py | 4 +-- src/PythonAPI/model/sketcher/sketch.py | 10 +++---- 14 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/PythonAPI/Test/TestSketcherSetAngle.py b/src/PythonAPI/Test/TestSketcherSetAngle.py index cbdd5fc3a..7dd937902 100644 --- a/src/PythonAPI/Test/TestSketcherSetAngle.py +++ b/src/PythonAPI/Test/TestSketcherSetAngle.py @@ -13,17 +13,17 @@ class SketcherSetAngle(SketcherTestCase): # Commit the transaction model.do() # Check the result - dot_product = (l1.endPointData().x() - l1.startPointData().x()) * \ - (l2.endPointData().x() - l2.startPointData().x()) + \ - (l1.endPointData().y() - l1.startPointData().y()) * \ - (l2.endPointData().y() - l2.startPointData().y()) + dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \ + (l2.endPoint().x() - l2.startPoint().x()) + \ + (l1.endPoint().y() - l1.startPoint().y()) * \ + (l2.endPoint().y() - l2.startPoint().y()) norm_1 = math.sqrt( - math.pow((l1.endPointData().x() - l1.startPointData().x()), 2) + - math.pow((l1.endPointData().y() - l1.startPointData().y()), 2) + math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) + + math.pow((l1.endPoint().y() - l1.startPoint().y()), 2) ) norm_2 = math.sqrt( - math.pow((l2.endPointData().x() - l2.startPointData().x()), 2) + - math.pow((l2.endPointData().y() - l2.startPointData().y()), 2) + math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) + + math.pow((l2.endPoint().y() - l2.startPoint().y()), 2) ) angle = math.acos(dot_product / (norm_1 * norm_2)) self.assertAlmostEqual( diff --git a/src/PythonAPI/Test/TestSketcherSetCoincident.py b/src/PythonAPI/Test/TestSketcherSetCoincident.py index ae07123c8..8f75d1393 100644 --- a/src/PythonAPI/Test/TestSketcherSetCoincident.py +++ b/src/PythonAPI/Test/TestSketcherSetCoincident.py @@ -6,18 +6,18 @@ class SketcherSetCoincident(SketcherTestCase): def test_set_coincident(self): l1 = self.sketch.addLine(0, 0, 0, 1) l2 = self.sketch.addLine(0, 1, 1, 1) - self.sketch.setCoincident(l1.endPointData(), l2.startPointData()) + self.sketch.setCoincident(l1.endPoint(), l2.startPoint()) model.do() def test_none_type_arguments(self): l2 = self.sketch.addLine(0, 1, 1, 1) with self.assertRaises(TypeError): - self.sketch.setCoincident(None, l2.startPointData()) + self.sketch.setCoincident(None, l2.startPoint()) def test_empty_arguments(self): l1 = self.sketch.addLine(0, 0, 0, 1) with self.assertRaises(TypeError): - self.sketch.setCoincident(l1.endPointData()) + self.sketch.setCoincident(l1.endPoint()) if __name__ == "__main__": unittest.main(verbosity=2) \ No newline at end of file diff --git a/src/PythonAPI/Test/TestSketcherSetEqual.py b/src/PythonAPI/Test/TestSketcherSetEqual.py index 496562927..9ffdb8774 100644 --- a/src/PythonAPI/Test/TestSketcherSetEqual.py +++ b/src/PythonAPI/Test/TestSketcherSetEqual.py @@ -14,12 +14,12 @@ class SketcherSetEqual(SketcherTestCase): model.do() # Check the result length_1 = math.sqrt( - math.pow((l1.endPointData().x() - l1.startPointData().x()), 2) + - math.pow((l1.endPointData().y() - l1.startPointData().y()), 2) + math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) + + math.pow((l1.endPoint().y() - l1.startPoint().y()), 2) ) length_2 = math.sqrt( - math.pow((l2.endPointData().x() - l2.startPointData().x()), 2) + - math.pow((l2.endPointData().y() - l2.startPointData().y()), 2) + math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) + + math.pow((l2.endPoint().y() - l2.startPoint().y()), 2) ) self.assertAlmostEqual(length_1, length_2, delta=TestSketcher.DELTA) diff --git a/src/PythonAPI/Test/TestSketcherSetFillet.py b/src/PythonAPI/Test/TestSketcherSetFillet.py index f84b67a4e..b6e90ea9c 100644 --- a/src/PythonAPI/Test/TestSketcherSetFillet.py +++ b/src/PythonAPI/Test/TestSketcherSetFillet.py @@ -6,7 +6,7 @@ class SketcherSetFillet(SketcherTestCase): def runTest(self): l1 = self.sketch.addLine(0, 0, 0, 1) l2 = self.sketch.addLine(0, 1, 1, 1) - self.sketch.setCoincident(l1.endPointData(), l2.startPointData()) + self.sketch.setCoincident(l1.endPoint(), l2.startPoint()) self.sketch.setFillet(l1.result(), l2.result(), 10.0) model.do() diff --git a/src/PythonAPI/Test/TestSketcherSetHorizontal.py b/src/PythonAPI/Test/TestSketcherSetHorizontal.py index 0b795e77b..1f0ee545c 100644 --- a/src/PythonAPI/Test/TestSketcherSetHorizontal.py +++ b/src/PythonAPI/Test/TestSketcherSetHorizontal.py @@ -7,7 +7,7 @@ class SketcherSetHorizontal(SketcherTestCase): line = self.sketch.addLine(0, 0, 1, 1) self.sketch.setHorizontal(line.result()) model.do() - self.assertEqual(line.startPointData().y(), line.endPointData().y()) + self.assertEqual(line.startPoint().y(), line.endPoint().y()) if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/src/PythonAPI/Test/TestSketcherSetLength.py b/src/PythonAPI/Test/TestSketcherSetLength.py index b56650b9e..bbbcab6dd 100644 --- a/src/PythonAPI/Test/TestSketcherSetLength.py +++ b/src/PythonAPI/Test/TestSketcherSetLength.py @@ -13,8 +13,8 @@ class SketcherSetLength(SketcherTestCase): model.do() # Check the result length = math.sqrt( - math.pow((line.endPointData().x() - line.startPointData().x()), 2) + - math.pow((line.endPointData().y() - line.startPointData().y()), 2) + math.pow((line.endPoint().x() - line.startPoint().x()), 2) + + math.pow((line.endPoint().y() - line.startPoint().y()), 2) ) self.assertAlmostEqual(length, 25.0, delta=TestSketcher.DELTA) diff --git a/src/PythonAPI/Test/TestSketcherSetPerpendicular.py b/src/PythonAPI/Test/TestSketcherSetPerpendicular.py index b572d9e3a..766fc5057 100644 --- a/src/PythonAPI/Test/TestSketcherSetPerpendicular.py +++ b/src/PythonAPI/Test/TestSketcherSetPerpendicular.py @@ -11,10 +11,10 @@ class SketcherSetPerpendicular(SketcherTestCase): self.sketch.setPerpendicular(l1.result(), l2.result()) model.do() - dot_product = (l1.endPointData().x() - l1.startPointData().x()) * \ - (l2.endPointData().x() - l2.startPointData().x()) + \ - (l1.endPointData().y() - l1.startPointData().y()) * \ - (l2.endPointData().y() - l2.startPointData().y()) + dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \ + (l2.endPoint().x() - l2.startPoint().x()) + \ + (l1.endPoint().y() - l1.startPoint().y()) * \ + (l2.endPoint().y() - l2.startPoint().y()) self.assertAlmostEqual(dot_product, 0.0, delta=TestSketcher.DELTA) if __name__ == "__main__": diff --git a/src/PythonAPI/Test/TestSketcherSetTangent.py b/src/PythonAPI/Test/TestSketcherSetTangent.py index 2e782649c..135379189 100644 --- a/src/PythonAPI/Test/TestSketcherSetTangent.py +++ b/src/PythonAPI/Test/TestSketcherSetTangent.py @@ -8,7 +8,7 @@ class SketcherSetTangent(SketcherTestCase): self.line = self.sketch.addLine(0, 0, 0, 1) self.arc = self.sketch.addArc(0, 1, 0, 0, 1, 1) self.sketch.setCoincident( - self.line.endPointData(), self.arc.startPoint() + self.line.endPoint(), self.arc.startPoint() ) def test_set_tangent(self): diff --git a/src/PythonAPI/Test/TestSketcherSetVertical.py b/src/PythonAPI/Test/TestSketcherSetVertical.py index cda9f6c63..5128c5b6b 100644 --- a/src/PythonAPI/Test/TestSketcherSetVertical.py +++ b/src/PythonAPI/Test/TestSketcherSetVertical.py @@ -7,7 +7,7 @@ class SketcherSetVertical(SketcherTestCase): line = self.sketch.addLine(0, 0, 1, 1) self.sketch.setVertical(line.result()) model.do() - self.assertEqual(line.startPointData().x(), line.endPointData().x()) + self.assertEqual(line.startPoint().x(), line.endPoint().x()) if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index c6e383680..32bc1553a 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -25,10 +25,10 @@ l2 = mybase.addLine(0, 1, 1, 1) l3 = mybase.addLine(1, 1, 1, 0) l4 = mybase.addLine(1, 0, 0, 0) -mybase.setCoincident(l1.endPointData(), l2.startPointData()) -mybase.setCoincident(l2.endPointData(), l3.startPointData()) -mybase.setCoincident(l3.endPointData(), l4.startPointData()) -mybase.setCoincident(l4.endPointData(), l1.startPointData()) +mybase.setCoincident(l1.endPoint(), l2.startPoint()) +mybase.setCoincident(l2.endPoint(), l3.startPoint()) +mybase.setCoincident(l3.endPoint(), l4.startPoint()) +mybase.setCoincident(l4.endPoint(), l1.startPoint()) mybase.setParallel(l1.result(), l3.result()) mybase.setParallel(l2.result(), l4.result()) @@ -36,7 +36,7 @@ mybase.setParallel(l2.result(), l4.result()) mybase.setPerpendicular(l1.result(), l4.result()) mywidth = mybase.setLength(l1.result(), 50) -mylength = mybase.setDistance(l1.startPointData(), l3.result(), 50) +mylength = mybase.setDistance(l1.startPoint(), l3.result(), 50) # Creating the extrusion diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py index 6d844802b..e47e9c0b9 100644 --- a/src/PythonAPI/examples/MakeBrick2.py +++ b/src/PythonAPI/examples/MakeBrick2.py @@ -33,7 +33,7 @@ mybase.setParallel(line[1].result(), line[3].result()) mybase.setPerpendicular(line[0].result(), line[3].result()) mywidth = mybase.setLength(line[0].result(), 50) -mylength = mybase.setDistance(line[0].startPointData(), line[2].result(), 50) +mylength = mybase.setDistance(line[0].startPoint(), line[2].result(), 50) # Creating the extrusion diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index 040647c41..0d9e4e536 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -30,7 +30,7 @@ def vertical_body(): left, top, right, bottom = sketch.addPolygon(*geom_points) # Set constraints - sketch.setRigid(left.startPointData()) + sketch.setRigid(left.startPoint()) sketch.setHorizontal(bottom.result()) sketch.setHorizontal(top.result()) @@ -41,7 +41,7 @@ def vertical_body(): sketch.setLength(top.result(), "L") sketch.setLength(left.result(), "L") - sketch.setFillet(left.endPointData(), 32) + sketch.setFillet(left.endPoint(), 32) model.do() #!!! @@ -88,13 +88,13 @@ def bottom_body(): sketch.setLength(h2.result(), 20) sketch.setCoincident(arc.center(), v1.result()) - sketch.setCoincident(arc.startPoint(), h2.endPointData()) - sketch.setCoincident(arc.endPoint(), h1.startPointData()) + sketch.setCoincident(arc.startPoint(), h2.endPoint()) + sketch.setCoincident(arc.endPoint(), h1.startPoint()) # Binding left_e = sketch.addLine("Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1") - sketch.setCoincident(left_e.startPointData(), left.endPointData()) - sketch.setCoincident(left_e.endPointData(), left.startPointData()) + sketch.setCoincident(left_e.startPoint(), left.endPoint()) + sketch.setCoincident(left_e.endPoint(), left.startPoint()) model.do() #!!! @@ -139,15 +139,15 @@ def body_3(): sketch.setLength(top_left.result(), l) sketch.setCoincident(top_middle.result(), arc.center()) - sketch.setCoincident(top_middle.endPointData(), arc.startPoint()) - sketch.setCoincident(top_middle.startPointData(), arc.endPoint()) + sketch.setCoincident(top_middle.endPoint(), arc.startPoint()) + sketch.setCoincident(top_middle.startPoint(), arc.endPoint()) sketch.setRadius(arc.result(), r) # Binding bottom_e = sketch.addLine("Boolean_1_1/Modified_1|Boolean_1_1/Modified_3") - sketch.setCoincident(bottom_e.result(), bottom.startPointData()) - sketch.setCoincident(bottom_e.startPointData(), bottom.endPointData()) + sketch.setCoincident(bottom_e.result(), bottom.startPoint()) + sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint()) model.do() #!!! @@ -170,11 +170,11 @@ def body_4(): # Binding bottom_e = sketch.addLine("Boolean_2_1/Modified_8|Boolean_2_1/Modified_7") - sketch.setCoincident(bottom_e.endPointData(), bottom.startPointData()) - sketch.setCoincident(bottom_e.startPointData(), left.startPointData()) + sketch.setCoincident(bottom_e.endPoint(), bottom.startPoint()) + sketch.setCoincident(bottom_e.startPoint(), left.startPoint()) left_e = sketch.addLine("Boolean_2_1/Modified_3|Boolean_2_1/Modified_2") - sketch.setCoincident(left_e.startPointData(), left.endPointData()) + sketch.setCoincident(left_e.startPoint(), left.endPoint()) model.do() #!!! diff --git a/src/PythonAPI/model/sketcher/line.py b/src/PythonAPI/model/sketcher/line.py index 215eeba80..128e7b3c8 100644 --- a/src/PythonAPI/model/sketcher/line.py +++ b/src/PythonAPI/model/sketcher/line.py @@ -64,10 +64,10 @@ class Line(Entity): # TODO : methods below will be removed. # Kept until all tests have been updated - def startPointData(self): + def startPoint(self): return self._start_point - def endPointData(self): + def endPoint(self): return self._end_point def setExternal(self, name): diff --git a/src/PythonAPI/model/sketcher/sketch.py b/src/PythonAPI/model/sketcher/sketch.py index ed0b1398a..9dabe0a9d 100644 --- a/src/PythonAPI/model/sketcher/sketch.py +++ b/src/PythonAPI/model/sketcher/sketch.py @@ -19,9 +19,9 @@ Example of code: >>> plane = model.defaultPlane("XOY") >>> sketch = model.addSketch(part, plane) >>> line = sketch.addLine(0, 0, 0, 1) - >>> line.endPointData().x() + >>> line.endPoint().x() 0.0 - >>> line.endPointData().y() + >>> line.endPoint().y() 1.0 """ @@ -381,7 +381,7 @@ class Sketch(Interface): # Adding and connecting next lines for c2 in coords[2:]: line_2 = self.addLine(c1, c2) - self.setCoincident(line_1.endPointData(), line_2.startPointData()) + self.setCoincident(line_1.endPoint(), line_2.startPoint()) polyline.append(line_2) c1 = c2 line_1 = line_2 @@ -398,10 +398,10 @@ class Sketch(Interface): cn = coords[len(coords) - 1] ln = self.addLine(cn, c0) self.setCoincident( - pg[len(coords) - 2].endPointData(), ln.startPointData() + pg[len(coords) - 2].endPoint(), ln.startPoint() ) self.setCoincident( - ln.endPointData(), pg[0].startPointData() + ln.endPoint(), pg[0].startPoint() ) pg.append(ln) return pg -- 2.39.2