]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[PythonAPI] Rename startPointData()/endPointData() to startPoint()/endPoint()
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 18 Dec 2015 12:32:31 +0000 (15:32 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 18 Dec 2015 12:32:31 +0000 (15:32 +0300)
14 files changed:
src/PythonAPI/Test/TestSketcherSetAngle.py
src/PythonAPI/Test/TestSketcherSetCoincident.py
src/PythonAPI/Test/TestSketcherSetEqual.py
src/PythonAPI/Test/TestSketcherSetFillet.py
src/PythonAPI/Test/TestSketcherSetHorizontal.py
src/PythonAPI/Test/TestSketcherSetLength.py
src/PythonAPI/Test/TestSketcherSetPerpendicular.py
src/PythonAPI/Test/TestSketcherSetTangent.py
src/PythonAPI/Test/TestSketcherSetVertical.py
src/PythonAPI/examples/MakeBrick1.py
src/PythonAPI/examples/MakeBrick2.py
src/PythonAPI/examples/Platine.py
src/PythonAPI/model/sketcher/line.py
src/PythonAPI/model/sketcher/sketch.py

index cbdd5fc3ae4bc7817ed25229534fce0f5db9d7d5..7dd937902441740da3f564336464adfbd7be047e 100644 (file)
@@ -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(
index ae07123c87ee92e8b273e1593719af523e8ff96d..8f75d13939ff92e21a0744ed5a49446a9a67861e 100644 (file)
@@ -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
index 49656292709c5e2bdb975ae7d76986d4b0c7f5e6..9ffdb877454ca9cff4af5aa104cf8c1e38881412 100644 (file)
@@ -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)
 
index f84b67a4ef0e3f9bea2afd2820aec405e0fcb78a..b6e90ea9cf9c1764815715d556df552c9033a827 100644 (file)
@@ -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()
 
index 0b795e77b1f585ff59a1eaa3857fdcefdbe668db..1f0ee545c84c4ee82fbd63f9e72ec1a6783e7155 100644 (file)
@@ -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
index b56650b9e25165d6c092575c584552bb2850fb04..bbbcab6dd90452e3b04a8522b7e9b48d1a6c662f 100644 (file)
@@ -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)
         
index b572d9e3aee9f7c1123a3af78ec01af938a67f87..766fc5057a758cb3d360a9da75b2f4e5978ff6f0 100644 (file)
@@ -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__":
index 2e782649c7744c826c5845a00812c2e6193aaf92..135379189d1559f02c99b0ab6999c726dcf49c34 100644 (file)
@@ -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):
index cda9f6c63048f39ec6684a450a85f65b55d56f28..5128c5b6b1063c37edb717cf05684ea3c6202c2e 100644 (file)
@@ -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
index c6e383680732ee4d52ef6629219e10d4979b9086..32bc1553a9e8fd4c72a74a9b89fc4710caff7a94 100644 (file)
@@ -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
 
index 6d844802b7017fbdd58d19185c5a1932e0174d96..e47e9c0b9b25fd9ffce277662de506ec4c26117f 100644 (file)
@@ -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
index 040647c410c893e66fd6bcf15cae80f0d05aaf69..0d9e4e53697e46e66673754cc3536acfc61eb4a6 100644 (file)
@@ -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()  #!!!
 
index 215eeba809b5f6777c39e839b834e23a61326a86..128e7b3c80f367b8a9b279081915ca5eeb186e71 100644 (file)
@@ -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):
index ed0b1398ac0766955e24d51e8d5f86d25b7031ae..9dabe0a9df299d520accd21d387f99117c5a1d45 100644 (file)
@@ -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