1 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
3 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 # File : GEOM_example3.py
25 # Author : Paul RASCLE, EDF
32 from time import sleep
34 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
35 myBuilder = salome.myStudy.NewBuilder()
37 gg = salome.ImportComponentGUI("GEOM")
39 point0 = geom.MakePointStruct(0.,0.,0.)
40 pointz1 = geom.MakePointStruct(0.,0.,1.)
41 dirz = geom.MakeDirection(pointz1)
43 torus1 = geompy.MakeTorus(point0,dirz,150.,25.)
44 id_torus1 = geompy.addToStudy(torus1,"torus1")
45 gg.createAndDisplayGO(id_torus1)
47 torus2 = geom.MakeCopy(torus1)
48 torus2 = geom.MakeTranslation(torus2,0.,0.,100.)
49 id_torus2 = geompy.addToStudy(torus2,"torus2")
50 gg.createAndDisplayGO(id_torus2)
52 cylz1 = geompy.MakeCylinder(point0,dirz,25.,100.)
58 acyl = geom.MakeCopy(cylz1)
59 x = 150. * math.cos(ind * math.pi/3.)
60 y = 150. * math.sin(ind * math.pi/3.)
63 acyl = geompy.MakeTranslation(acyl,x,y,z)
64 id_acyl = geompy.addToStudy(acyl,name)
65 gg.createAndDisplayGO(id_acyl)
66 shapeList.append(acyl)
67 idList.append(id_acyl)
70 shapeList.append(torus1)
71 shapeList.append(torus2)
72 idList.append(id_torus1)
73 idList.append(id_torus2)
76 for shape in shapeList:
77 iorStringList.append(shape._get_Name())
79 cage = geompy.MakeCompound(iorStringList)
80 id_cage = geompy.addToStudy(cage,"cage")
81 gg.createAndDisplayGO(id_cage)
102 gg.setTransparency(id_torus1,0.5)
104 gg.setDisplayMode(id_torus1,1)
105 gg.setDisplayMode(id_torus2,1)
106 gg.setDisplayMode(id_acyl,1)
107 #gg.setDisplayMode(id_cage,1)
109 gg.setColor(id_torus1,0,0,255)
110 gg.setColor(id_torus2,255,0,0)
111 gg.setColor(id_acyl,0,255,0)
112 #gg.setColor(id_cage,255,255,0)