Salome HOME
Synchronize adm files
[modules/geom.git] / doc / salome / examples / point_coordinates.py
1 # Point Coordinates
2
3 import math
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9
10 # create a point
11 point = geompy.MakeVertex(15., 23., 80.)
12
13 # get the coordinates of the point and check its values
14 coords = geompy.PointCoordinates(point)
15
16 # check the obtained coordinate values
17 tolerance = 1.e-07
18 def IsEqual(val1, val2): 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 (",
24     print coords[0], ", ", coords[1], ", ", coords[2], ")"
25     pass