Salome HOME
Switch to SSL mode for tests : naive approach
[modules/geom.git] / doc / salome / examples / point_coordinates.py
index a87cc887ff6a6aa019bcc3cb6eeffdb540fa4000..65a5ab61acb7118cfbfe5b5c33beed57c4533974 100644 (file)
@@ -1,8 +1,7 @@
 # Point Coordinates
 
-import math
 import salome
-salome.salome_init()
+salome.salome_init_without_session()
 import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New()
@@ -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