Salome HOME
Fix compilation error (conflict of OK name between OCCT Plate_Plate.hxx and GEOM...
[modules/geom.git] / doc / salome / examples / basic_properties.py
index 239655901986916a78223c580fc5d47ef0dcaef3..744eb430452e2512361efbb38c6a1793eb52c0b1 100644 (file)
@@ -1,20 +1,24 @@
 # Basic Properties
 
-import geompy
+import salome
+salome.salome_init_without_session()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
 import math
 
 # create a box
 box = geompy.MakeBoxDXDYDZ(100,30,100)
 props = geompy.BasicProperties(box)
-print "\nBox 100x30x100 Basic Properties:"
-print " Wires length: ", props[0]
-print " Surface area: ", props[1]
-print " Volume      : ", props[2]
+print("\nBox 100x30x100 Basic Properties:")
+print(" Wires length: ", props[0])
+print(" Surface area: ", props[1])
+print(" Volume      : ", props[2])
 length = math.sqrt((props[0] - 1840)*(props[0] - 1840))
 area = math.sqrt((props[1] - 32000)*(props[1] - 32000))
 volume = math.sqrt((props[2] - 300000)*(props[2] - 300000))
 if length > 1e-7 or area > 1e-7 or volume > 1e-7:
-    print "While must be:"
-    print " Wires length: ", 1840
-    print " Surface area: ", 32000
-    print " Volume      : ", 300000.
+    print("While must be:")
+    print(" Wires length: ", 1840)
+    print(" Surface area: ", 32000)
+    print(" Volume      : ", 300000.)