]> SALOME platform Git repositories - modules/geom.git/blob - doc/salome/examples/basic_operations_ex02.py
Salome HOME
Synchronize adm files
[modules/geom.git] / doc / salome / examples / basic_operations_ex02.py
1 # Archimede
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
9
10 # create a vertex and a vector
11 p0   = geompy.MakeVertex(  0.,   0.,   0.)
12 p200 = geompy.MakeVertex(200., 200., 200.)
13
14 # create a box from two points
15 box = geompy.MakeBoxTwoPnt(p0, p200)
16
17 # perform an Archimede operation on the selected shape with selected parameters
18 weight  = 1000000.
19 waterdensity = 1.
20 meshingdeflection = 0.01
21 archimede  = geompy.Archimede(box, weight, waterdensity, meshingdeflection)
22
23 # add objects in the study
24 id_box = geompy.addToStudy(box,"Box")
25 id_archimede = geompy.addToStudy(archimede,"Archimede")
26
27 # display the box and the result of Archimede operation
28 gg.createAndDisplayGO(id_box)
29 gg.setDisplayMode(id_box,1)
30 gg.createAndDisplayGO(id_archimede)
31 gg.setDisplayMode(id_archimede,1)