]> SALOME platform Git repositories - modules/geom.git/blob - doc/salome/examples/point_coordinates.py
Salome HOME
bos #29468: Advanced geometry features: distance Edge-Edge & Face-Face
[modules/geom.git] / doc / salome / examples / point_coordinates.py
1 # Point Coordinates
2
3 import salome
4 salome.salome_init_without_session()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8
9 # create a point
10 point = geompy.MakeVertex(15., 23., 80.)
11
12 # get the coordinates of the point and check its values
13 coords = geompy.PointCoordinates(point)
14
15 # check the obtained coordinate values
16 def IsEqual(val1, val2, tolerance = 1.e-07):
17     import math
18     return (math.fabs(val1 - val2) < tolerance)
19
20 if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
21     print("All values are OK.")
22 else :
23     print("Coordinates of point must be (15, 23, 80), but returned (", end=' ')
24     print(coords[0], ", ", coords[1], ", ", coords[2], ")")
25     pass