Salome HOME
Merge multi-study removal branch.
[modules/geom.git] / doc / salome / examples / transformation_operations_ex08.py
1 # Multi Translation
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8 gg = salome.ImportComponentGUI("GEOM")
9
10 # create vertices and vectors
11 p0  = geompy.MakeVertex( 0.,  0.,  0.)
12 px  = geompy.MakeVertex(20.,  0.,  0.)
13 py  = geompy.MakeVertex( 0., 20.,  0.)
14 pz  = geompy.MakeVertex( 0.,  0., 20.)
15 pxy = geompy.MakeVertex( 50., 0., 0.)
16 pxyz = geompy.MakeVertex( 50., 50., 50.)
17 vz  = geompy.MakeVector(p0, pz)
18 vxy = geompy.MakeVector(px, py)
19 vtr1d = geompy.MakeVector(p0, pxyz)
20 vtr2d = geompy.MakeVector(p0, pxy)
21
22 # create an arc
23 arc = geompy.MakeArc(py, pz, px)
24
25 # create a wire
26 wire = geompy.MakeWire([vxy, arc])
27
28 # create a planar face
29 face = geompy.MakeFace(wire, 1)
30
31 # create a prism
32 prism = geompy.MakePrismVecH(face, vz, 20.0)
33
34 # translate the given object along the given vector a given number of times
35 tr1d = geompy.MakeMultiTranslation1D(prism, vtr1d, 20, 4)
36
37 # consequently apply two specified translations to the object a given number of times
38 tr2d = geompy.MakeMultiTranslation2D(prism, vtr1d, 20, 4, vtr2d, 80, 3)
39
40 # add objects in the study
41 id_prism = geompy.addToStudy(prism,"Prism")
42 id_tr1d = geompy.addToStudy(tr1d,"Translation 1D")
43 id_tr2d = geompy.addToStudy(tr2d,"Translation 2D")
44
45 # display the prism and the results of fillet operation
46 gg.createAndDisplayGO(id_prism)
47 gg.setDisplayMode(id_prism,1)
48 gg.createAndDisplayGO(id_tr1d)
49 gg.setDisplayMode(id_tr1d,1)
50 gg.createAndDisplayGO(id_tr2d)
51 gg.setDisplayMode(id_tr2d,1)