Salome HOME
Implementation of gluing faces by given list (for PAL13191).
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition5.py
1 #  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 #
4 #  This library is free software; you can redistribute it and/or
5 #  modify it under the terms of the GNU Lesser General Public
6 #  License as published by the Free Software Foundation; either
7 #  version 2.1 of the License.
8 #
9 #  This library is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 #  Lesser General Public License for more details.
13 #
14 #  You should have received a copy of the GNU Lesser General Public
15 #  License along with this library; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
21 #
22 #  File   : GEOM_Partition5.py
23 #  Module : GEOM
24
25 #%Make geometry (like CEA script (A4)) using Partition algorithm%
26 # import gallery_01_GEOM
27 # reload(gallery_01_GEOM)
28
29 # -- Import geompy pour piloter GEOM par script
30
31 import geompy
32 geom = geompy.geom
33
34 # -- Dimensions de la boite enti\88re
35
36 LX, LY, LZ = 300.0, 150.0, 150.0
37 p0 = geompy.MakeVertex(0.,0.,0.)
38 vy = geompy.MakeVectorDXDYDZ(0.,1.,0.)
39
40 # -- D\89finition du plan de sym\89trie (O,Ox,Oz)
41
42 symPlane = geompy.MakePlane(p0, vy, 10.0)
43
44 # -- bo
45
46 bo = geompy.MakeBoxDXDYDZ(LX, LY, LZ)
47 bo = geompy.MakeTranslation(bo, 0.0, -LY/2, -LZ/2)
48
49 # -- Galerie principale
50
51 gal_diam = 80.0
52 gal_lony = LY
53 gal_x = LX-20.0-gal_diam/2
54
55 gal = geompy.MakeCylinder(p0, vy, gal_diam/2, gal_lony)
56 gal = geompy.MakeTranslation(gal, gal_x, -gal_lony/2, 0.0)
57
58 # -- Galerie perpendiculaire
59 # -- Dimensions de la galerie perpendiculaire
60 # -- La longueur est compt\89\80 partir du centre
61 # -- de la galerie principale
62
63 gpe_long, gpe_diam = 200.0, 60.0 
64 gpe_x = gal_x
65 gpe = geompy.MakeCylinder(
66     p0,
67     geompy.MakeVectorDXDYDZ(-1.,0.,0.),
68     gpe_diam/2,gpe_long)
69 gpe = geompy.MakeTranslation(gpe, gpe_x, 0, 0)
70
71 # -- Dimensions d'une alveole
72 # -- Construction d'une alv\89ole
73
74 alv_long, alv_diam = 60.0, 18.0
75 alv01 = geompy.MakeCylinder(p0, vy, alv_diam/2, alv_long)
76 alv02 = geompy.MakeMirrorByPlane(alv01, symPlane)
77 alv0 = geompy.MakeCompound([alv01, alv02])
78
79 # -- Construction des alv\89oles
80
81 alv_del, alv_sep = 40.0, 35.0
82 alv1 = geompy.MakeTranslation(alv0, gal_x-gal_diam/2-alv_sep, 0.0, 0.0)
83 alv2 = geompy.MakeTranslation(alv1, -alv_del, 0.0, 0.0 )
84 alv3 = geompy.MakeTranslation(alv2, -alv_del, 0.0, 0.0 )
85 alv = geompy.MakeCompound([alv1, alv2, alv3])
86
87 # -- Remplissage de la BO
88
89 gallery = geompy.MakePartition([alv, bo], [], [], [gal, gpe])
90
91 subshapes = geompy.SubShapeAll(gallery, geompy.ShapeType["SHAPE"])
92
93 alvGOs = []
94 alvGOs.append(subshapes[0])
95 alvGOs.append(subshapes[1])
96 alvGOs.append(subshapes[2])
97 alvGOs.append(subshapes[3])
98 alvGOs.append(subshapes[4])
99 alvGOs.append(subshapes[5])
100 alvcomp = geompy.MakeCompound(alvGOs)
101
102 boGO  = subshapes[6]
103 galGO = subshapes[7]
104 gpeGO = subshapes[8]
105
106 gallery = geompy.MakeCompound([boGO, alvcomp, gpeGO, galGO])
107
108 geompy.addToStudy(gallery,"Gallery 2")