Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition2.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_Partition2.py
24 #  Module : GEOM
25 # import callovo_01_GEOM
26 # reload(callovo_01_GEOM)
27 # --------------------------------------------
28 # Geometrie avec une galerie perpendiculaire
29 # --------------------------------------------
30 #
31 import geompy
32 geom = geompy.geom
33
34 vecx = geompy.MakeVectorDXDYDZ(1.,0.,0.)
35 vecy = geompy.MakeVectorDXDYDZ(0.,1.,0.)
36
37 # -- colis
38
39 colis_xmin = 05.76
40 colis_xmax = 19.83
41 colis_radius = 0.3
42
43 colis = geompy.MakeCylinder(
44     geompy.MakeVertex(colis_xmin,0.,0.),
45     vecx,
46     colis_radius,
47     colis_xmax-colis_xmin)
48
49 # -- bo
50
51 bo_xmin = 04.83
52 bo_xmax = colis_xmax
53 bo_radius = 1.23
54
55 bo = geompy.MakeCylinder(
56     geompy.MakeVertex(bo_xmin,0.,0.),
57     vecx,
58     bo_radius,
59     bo_xmax-bo_xmin)
60
61
62 # -- rupture alveole
63
64 alvRup_xmin = 04.46
65 alvRup_xmax = colis_xmax
66 alvRup_radius = 1.6
67
68 alvRup = geompy.MakeCylinder(
69     geompy.MakeVertex(alvRup_xmin,0.,0.),
70     vecx,
71     alvRup_radius,
72     alvRup_xmax-alvRup_xmin)
73
74
75 # bouchon
76
77 bouchon_xmin = colis_xmax
78 bouchon_xmax = 22.83
79 bouchon_radius = alvRup_radius
80
81 bouchon = geompy.MakeCylinder(
82     geompy.MakeVertex(bouchon_xmin,0.,0.),
83     vecx,
84     bouchon_radius,
85     bouchon_xmax-bouchon_xmin)
86
87 # galerie
88
89 galerie_xmax = 25.0
90 galerie_radius = 3.0
91 box_y = 30.0
92
93 pnt_galerie_xmax = geompy.MakeVertex(galerie_xmax,0.,0.)
94
95 galerie = geompy.MakeCylinder(
96     pnt_galerie_xmax,
97     vecy,
98     galerie_radius,
99     box_y)
100 galerie = geompy.MakeTranslation(galerie, 0, -box_y/2, 0)
101
102 # -- box
103
104 box = geompy.MakeBox(0., 0., 0., galerie_xmax, box_y, box_y)
105 box = geompy.MakeTranslation(box, 0.0, -box_y/2, -box_y/2)
106
107
108 # -- rupture galerie
109
110 galRup_xmax = galerie_xmax
111 galRup_radius = 3.9
112
113 galRup = geompy.MakeCylinder(
114     pnt_galerie_xmax,
115     vecy,
116     galRup_radius,
117     box_y)
118 galRup = geompy.MakeTranslation(galRup, 0, -box_y/2, 0)
119
120 # -- endommagement galerie
121
122 galEnd_xmax = galerie_xmax
123 galEnd_radius = 4.6
124
125 galEnd = geompy.MakeCylinder(pnt_galerie_xmax, vecy, galEnd_radius, box_y)
126 galEnd = geompy.MakeTranslation(galEnd, 0, -box_y/2, 0)
127
128 # -- endommagement alveole
129
130 alvEnd_xmin = 03.6
131 alvEnd_xmax = galerie_xmax
132 alvEnd_radius = 2.46
133
134 alvEnd = geompy.MakeCylinder(
135     geompy.MakeVertex(alvEnd_xmin,0.,0.),
136     vecx,
137     alvEnd_radius,
138     alvEnd_xmax-alvEnd_xmin)
139
140 # remove internal parts of galEnd intersecting alvEnd
141
142 galEnd_alvEnd = geompy.MakePartition([alvEnd], [], [], [galEnd])
143
144 GOList =  [colis]
145 GOList += [bo]
146 GOList += [alvRup]
147 #GOList += [galerie ]
148 GOList += [galRup]
149 GOList += [galEnd_alvEnd]
150
151 # --
152
153 # remove section parts outside bo and inside bouchon
154
155 callovo = geompy.MakePartition(GOList, [], [box], [galerie, bouchon])
156
157 geompy.addToStudy(callovo, "callovo perp. 2")