Salome HOME
sources v1.2
[modules/geom.git] / GEOM_SWIG / GEOM_example2.py
1 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
2 #
3 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5
6 #  This library is free software; you can redistribute it and/or 
7 #  modify it under the terms of the GNU Lesser General Public 
8 #  License as published by the Free Software Foundation; either 
9 #  version 2.1 of the License. 
10
11 #  This library is distributed in the hope that it will be useful, 
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 #  Lesser General Public License for more details. 
15
16 #  You should have received a copy of the GNU Lesser General Public 
17 #  License along with this library; if not, write to the Free Software 
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19
20 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 #
22 #
23 #
24 #  File   : GEOM_example2.py
25 #  Author : Paul RASCLE, EDF
26 #  Module : GEOM
27 #  $Header$
28
29 import salome
30 import geompy
31 import math
32
33 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry")
34 myBuilder = salome.myStudy.NewBuilder()
35
36 point0  = geom.MakePointStruct(0.,0.,0.)
37 pointz1 = geom.MakePointStruct(0.,0.,1.)
38 dirz = geom.MakeDirection(pointz1)
39
40 torus1 = geompy.MakeTorus(point0,dirz,150.,25.)
41 id_torus1 = geompy.addToStudy(torus1,"torus1")
42
43 torus2 = geom.MakeCopy(torus1)
44 torus2 = geom.MakeTranslation(torus2,0.,0.,100.)
45 id_torus2 = geompy.addToStudy(torus2,"torus2")
46
47 cylz1 = geompy.MakeCylinder(point0,dirz,25.,100.)
48
49 ind = 0
50 cyllist = []
51 while ind < 6:
52     acyl = geom.MakeCopy(cylz1)
53     x = 150. * math.cos(ind * math.pi/3.)
54     y = 150. * math.sin(ind * math.pi/3.)
55     z = 0.
56     name = "cyl%d"%(ind)
57     acyl = geompy.MakeTranslation(acyl,x,y,z)
58     id_acyl = geompy.addToStudy(acyl,name)
59     cyllist.append(acyl)
60     ind = ind +1
61
62
63
64