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