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
1 # Basic Properties
2
3 import salome
4 salome.salome_init_without_session()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8 import math
9
10 # create a box
11 box = geompy.MakeBoxDXDYDZ(100,30,100)
12 props = geompy.BasicProperties(box)
13 print("\nBox 100x30x100 Basic Properties:")
14 print(" Wires length: ", props[0])
15 print(" Surface area: ", props[1])
16 print(" Volume      : ", props[2])
17 length = math.sqrt((props[0] - 1840)*(props[0] - 1840))
18 area = math.sqrt((props[1] - 32000)*(props[1] - 32000))
19 volume = math.sqrt((props[2] - 300000)*(props[2] - 300000))
20 if length > 1e-7 or area > 1e-7 or volume > 1e-7:
21     print("While must be:")
22     print(" Wires length: ", 1840)
23     print(" Surface area: ", 32000)
24     print(" Volume      : ", 300000.)