geom/doc/salome/examples/point_coordinates.py

26 lines
709 B
Python
Raw Permalink Normal View History

2013-02-12 17:35:16 +06:00
# Point Coordinates
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
2017-06-13 14:57:14 +05:00
geompy = geomBuilder.New()
2013-02-12 17:35:16 +06:00
# create a point
point = geompy.MakeVertex(15., 23., 80.)
# get the coordinates of the point and check its values
coords = geompy.PointCoordinates(point)
# check the obtained coordinate values
def IsEqual(val1, val2, tolerance = 1.e-07):
import math
return (math.fabs(val1 - val2) < tolerance)
2013-02-12 17:35:16 +06:00
if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
2017-02-10 21:07:24 +05:00
print("All values are OK.")
2013-02-12 17:35:16 +06:00
else :
2017-02-10 21:07:24 +05:00
print("Coordinates of point must be (15, 23, 80), but returned (", end=' ')
print(coords[0], ", ", coords[1], ", ", coords[2], ")")
2013-02-12 17:35:16 +06:00
pass