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