Salome HOME
Merge from BR_plugins_pbyacs 03/04/2013
[modules/geom.git] / doc / salome / examples / blocks_operations_ex02.py
1 # Explode on Blocks
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 box and a sphere
11 box = geompy.MakeBoxDXDYDZ(200, 200, 200)
12 sphere = geompy.MakeSphereR(100)
13
14 # make a compound
15 compound = geompy.MakeCompound([box, sphere])
16
17 # get all the blocks of the given compound, by criteria: min_nb_faces <= nb. of faces <= max_nb_faces
18 min_nb_faces = 6
19 max_nb_faces = 6
20 make_block_explode = geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)
21
22 # add objects in the study
23 id_compound = geompy.addToStudy(compound, "Compound")
24 id_make_block_explode = geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")
25
26 # display the results
27 gg.createAndDisplayGO(id_compound)
28 gg.createAndDisplayGO(id_make_block_explode)
29 gg.setDisplayMode(id_make_block_explode,1)