Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Blocks Operations


Multi Transformation

1 # Multi Transformation
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 vertices
11 p_25_25_50 = geompy.MakeVertex(25., 25., 50.)
12 p_50_25_25 = geompy.MakeVertex(50., 25., 25.)
13 p_25_50_25 = geompy.MakeVertex(25., 50., 25.)
14 
15 box = geompy.MakeBoxDXDYDZ(50, 50, 50)
16 
17 top_face = geompy.GetFaceNearPoint(box, p_25_25_50)
18 yz_face = geompy.GetFaceNearPoint(box, p_50_25_25)
19 xz_face = geompy.GetFaceNearPoint(box, p_25_50_25)
20 
21 top_face_ind = geompy.GetSubShapeID(box, top_face)
22 yz_face_ind = geompy.GetSubShapeID(box, yz_face)
23 xz_face_ind = geompy.GetSubShapeID(box, xz_face)
24 
25 # Multi-transformate block and glue the result
26 box_tr1 = geompy.MakeMultiTransformation1D(box, yz_face_ind, top_face_ind, 3)
27 box_tr2 = geompy.MakeMultiTransformation2D(box, xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)
28 
29 # add objects in the study
30 id_box = geompy.addToStudy(box, "Box")
31 id_box_tr1 = geompy.addToStudy(box_tr1, "Multi-transformed Block 1D")
32 id_box_tr2 = geompy.addToStudy(box_tr2, "Multi-transformed Block 2D")
33 
34 # display the results
35 gg.createAndDisplayGO(id_box)
36 gg.setDisplayMode(id_box,1)
37 gg.createAndDisplayGO(id_box_tr1)
38 gg.createAndDisplayGO(id_box_tr2)

Download this script


Explode on Blocks

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)

Download this script


Propagate

1 # Propagate
2 
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 
9 # create a box
10 check_box = geompy.MakeBoxDXDYDZ(200, 200, 200)
11 
12 # build all possible propagation groups
13 listChains = geompy.Propagate(check_box)
14 
15 # add objects in the study
16 geompy.addToStudy(check_box, "Box")
17 ii = 1
18 for chain in listChains:
19  geompy.addToStudyInFather(check_box, chain, "propagation chain " + `ii`)
20  ii = ii + 1
21  pass
22 
23 salome.sg.updateObjBrowser(True)

Download this script