2013-02-12 17:35:16 +06:00
|
|
|
# Basic Properties
|
|
|
|
|
2013-04-04 13:06:43 +06:00
|
|
|
import salome
|
|
|
|
salome.salome_init()
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
|
|
|
geompy = geomBuilder.New(salome.myStudy)
|
2013-02-12 17:35:16 +06:00
|
|
|
import math
|
|
|
|
|
|
|
|
# create a box
|
|
|
|
box = geompy.MakeBoxDXDYDZ(100,30,100)
|
|
|
|
props = geompy.BasicProperties(box)
|
2017-02-10 21:07:24 +05:00
|
|
|
print("\nBox 100x30x100 Basic Properties:")
|
|
|
|
print(" Wires length: ", props[0])
|
|
|
|
print(" Surface area: ", props[1])
|
|
|
|
print(" Volume : ", props[2])
|
2013-02-12 17:35:16 +06:00
|
|
|
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:
|
2017-02-10 21:07:24 +05:00
|
|
|
print("While must be:")
|
|
|
|
print(" Wires length: ", 1840)
|
|
|
|
print(" Surface area: ", 32000)
|
|
|
|
print(" Volume : ", 300000.)
|