Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition5.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
23 #  File   : GEOM_Partition5.py
24 #  Module : GEOM
25 # import gallery_01_GEOM
26 # reload(gallery_01_GEOM)
27 # -- Import geompy pour piloter GEOM par script
28 #
29 import geompy
30 geom = geompy.geom
31
32 # -- Dimensions de la boite enti\88re
33
34 LX, LY, LZ = 300.0, 150.0, 150.0
35 p0 = geompy.MakeVertex(0.,0.,0.)
36 vy = geompy.MakeVectorDXDYDZ(0.,1.,0.)
37
38 # -- D\89finition du plan de sym\89trie (O,Ox,Oz)
39
40 symPlane = geompy.MakePlane(p0, vy, 10.0)
41
42 # -- bo
43
44 bo = geompy.MakeBoxDXDYDZ(LX, LY, LZ)
45 bo = geompy.MakeTranslation(bo, 0.0, -LY/2, -LZ/2)
46
47 # -- Galerie principale
48
49 gal_diam = 80.0
50 gal_lony = LY
51 gal_x = LX-20.0-gal_diam/2
52
53 gal = geompy.MakeCylinder(p0, vy, gal_diam/2, gal_lony)
54 gal = geompy.MakeTranslation(gal, gal_x, -gal_lony/2, 0.0)
55
56 # -- Galerie perpendiculaire
57 # -- Dimensions de la galerie perpendiculaire
58 # -- La longueur est compt\89\80 partir du centre
59 # -- de la galerie principale
60
61 gpe_long, gpe_diam = 200.0, 60.0 
62 gpe_x = gal_x
63 gpe = geompy.MakeCylinder(
64     p0,
65     geompy.MakeVectorDXDYDZ(-1.,0.,0.),
66     gpe_diam/2,gpe_long)
67 gpe = geompy.MakeTranslation(gpe, gpe_x, 0, 0)
68
69 # -- Dimensions d'une alveole
70 # -- Construction d'une alv\89ole
71
72 alv_long, alv_diam = 60.0, 18.0
73 alv01 = geompy.MakeCylinder(p0, vy, alv_diam/2, alv_long)
74 alv02 = geompy.MakeMirrorByPlane(alv01, symPlane)
75 alv0 = geompy.MakeCompound([alv01, alv02])
76
77 # -- Construction des alv\89oles
78
79 alv_del, alv_sep = 40.0, 35.0
80 alv1 = geompy.MakeTranslation(alv0, gal_x-gal_diam/2-alv_sep, 0.0, 0.0)
81 alv2 = geompy.MakeTranslation(alv1, -alv_del, 0.0, 0.0 )
82 alv3 = geompy.MakeTranslation(alv2, -alv_del, 0.0, 0.0 )
83 alv = geompy.MakeCompound([alv1, alv2, alv3])
84
85 # -- Remplissage de la BO
86
87 gallery = geompy.MakePartition([alv, bo], [], [], [gal, gpe])
88
89 subshapes = geompy.SubShapeAll(gallery, geompy.ShapeType["SHAPE"])
90
91 alvGOs = []
92 alvGOs.append(subshapes[0])
93 alvGOs.append(subshapes[1])
94 alvGOs.append(subshapes[2])
95 alvGOs.append(subshapes[3])
96 alvGOs.append(subshapes[4])
97 alvGOs.append(subshapes[5])
98 alvcomp = geompy.MakeCompound(alvGOs)
99
100 boGO  = subshapes[6]
101 galGO = subshapes[7]
102 gpeGO = subshapes[8]
103
104 gallery = geompy.MakeCompound([boGO, alvcomp, gpeGO, galGO])
105
106 geompy.addToStudy(gallery,"Gallery 2")