Salome HOME
Switch to SSL mode for tests : naive approach
[modules/geom.git] / doc / salome / examples / point_coordinates.py
old mode 100755 (executable)
new mode 100644 (file)
index e31569b..65a5ab6
@@ -1,11 +1,10 @@
 # Point Coordinates
 
-import math
 import salome
-salome.salome_init()
+salome.salome_init_without_session()
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 # create a point
 point = geompy.MakeVertex(15., 23., 80.)
@@ -14,12 +13,13 @@ point = geompy.MakeVertex(15., 23., 80.)
 coords = geompy.PointCoordinates(point)
 
 # check the obtained coordinate values
-tolerance = 1.e-07
-def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance)
+def IsEqual(val1, val2, tolerance = 1.e-07):
+    import math
+    return (math.fabs(val1 - val2) < tolerance)
 
 if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
-    print "All values are OK."
+    print("All values are OK.")
 else :
-    print "Coordinates of point must be (15, 23, 80), but returned (",
-    print coords[0], ", ", coords[1], ", ", coords[2], ")"
+    print("Coordinates of point must be (15, 23, 80), but returned (", end=' ')
+    print(coords[0], ", ", coords[1], ", ", coords[2], ")")
     pass