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