6 from salome.geom
import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
11 box = geompy.MakeBoxDXDYDZ(100,30,100)
12 cm = geompy.MakeCDG(box)
14 raise RuntimeError,
"MakeCDG(box) failed"
16 print "\nCentre of gravity of box has been successfully obtained:"
17 coords = geompy.PointCoordinates(cm)
18 print "(", coords[0],
", ", coords[1],
", ", coords[2],
")"
19 dx = math.sqrt((coords[0] - 50)*(coords[0] - 50))
20 dy = math.sqrt((coords[1] - 15)*(coords[1] - 15))
21 dz = math.sqrt((coords[2] - 50)*(coords[2] - 50))
22 if dx > 1e-7
or dy > 1e-7
or dz > 1e-7:
23 print "But must be (50, 15, 50)"