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