Salome HOME
sources v1.2
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition2.py
1 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
2 #
3 #  Copyright (C) 2003  CEA/DEN, EDF R&D
4 #
5 #
6 #
7 #  File   : GEOM_Partition2.py
8 #  Module : GEOM
9
10 #%Make geometry (like CEA script (A2)) using Partition algorithm%
11 # import callovo_01_GEOM
12 # reload(callovo_01_GEOM)
13
14
15 # --------------------------------------------
16 # Geometrie avec une galerie perpendiculaire
17 # --------------------------------------------
18
19 import geompy
20 geom = geompy.geom
21
22 # -- colis
23
24 colis_xmin = 05.76
25 colis_xmax = 19.83
26 colis_radius = 0.3
27
28 colis = geompy.MakeCylinder(
29     geom.MakePointStruct(colis_xmin,0.,0.),
30     geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)),
31     colis_radius,
32     colis_xmax-colis_xmin)
33
34 # -- bo
35
36 bo_xmin = 04.83
37 bo_xmax = colis_xmax
38 bo_radius = 1.23
39
40 bo = geompy.MakeCylinder(
41     geom.MakePointStruct(bo_xmin,0.,0.),
42     geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)),
43     bo_radius,
44     bo_xmax-bo_xmin)
45
46
47 # -- rupture alveole
48
49 alvRup_xmin = 04.46
50 alvRup_xmax = colis_xmax
51 alvRup_radius = 1.6
52
53 alvRup = geompy.MakeCylinder(
54     geom.MakePointStruct(alvRup_xmin,0.,0.),
55     geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)),
56     alvRup_radius,
57     alvRup_xmax-alvRup_xmin)
58
59
60 # bouchon
61
62 bouchon_xmin = colis_xmax
63 bouchon_xmax = 22.83
64 bouchon_radius = alvRup_radius
65
66 bouchon = geompy.MakeCylinder(
67     geom.MakePointStruct(bouchon_xmin,0.,0.),
68     geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)),
69     bouchon_radius,
70     bouchon_xmax-bouchon_xmin)
71
72 # galerie
73
74 galerie_xmax = 25.0
75 galerie_radius = 3.0
76 box_y = 30.0
77
78 galerie = geompy.MakeCylinder(
79     geom.MakePointStruct(galerie_xmax,0.,0.),
80     geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)),
81     galerie_radius,
82     box_y)
83 galerie = geompy.MakeTranslation(galerie, 0, -box_y/2, 0)
84
85 # -- box
86
87 box = geompy.MakeBox(0., 0., 0., galerie_xmax, box_y, box_y)
88 box = geompy.MakeTranslation(box, 0.0, -box_y/2, -box_y/2)
89
90
91 # -- rupture galerie
92
93 galRup_xmax = galerie_xmax
94 galRup_radius = 3.9
95
96 galRup = geompy.MakeCylinder(
97     geom.MakePointStruct(galerie_xmax,0.,0.),
98     geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)),
99     galRup_radius,
100     box_y)
101 galRup = geompy.MakeTranslation(galRup, 0, -box_y/2, 0)
102
103 # -- endommagement galerie
104
105 galEnd_xmax = galerie_xmax
106 galEnd_radius = 4.6
107
108 galEnd = geompy.MakeCylinder(
109     geom.MakePointStruct(galerie_xmax,0.,0.),
110     geom.MakeDirection(geom.MakePointStruct(0.,1.,0.)),
111     galEnd_radius,
112     box_y)
113 galEnd = geompy.MakeTranslation(galEnd, 0, -box_y/2, 0)
114
115 # -- endommagement alveole
116
117 alvEnd_xmin = 03.6
118 alvEnd_xmax = galerie_xmax
119 alvEnd_radius = 2.46
120
121 alvEnd = geompy.MakeCylinder(
122     geom.MakePointStruct(alvEnd_xmin,0.,0.),
123     geom.MakeDirection(geom.MakePointStruct(1.,0.,0.)),
124     alvEnd_radius,
125     alvEnd_xmax-alvEnd_xmin)
126
127 # remove internal parts of galEnd intersecting alvEnd
128
129 galEnd_alvEnd = geompy.Partition(
130    [ alvEnd._get_Name() ] , [], [], [ galEnd._get_Name() ] )
131
132 iorL =  [ colis._get_Name()   ]
133 iorL += [ bo._get_Name()      ]
134 iorL += [ alvRup._get_Name()  ]
135 #iorL += [ galerie._get_Name() ]
136 iorL += [ galRup._get_Name()  ]
137 iorL += [ galEnd_alvEnd._get_Name() ]
138
139 # --
140
141 # remove section parts outside bo and inside bouchon
142
143 callovo = geompy.Partition( 
144     iorL, [], [ box._get_Name() ], [galerie._get_Name(), bouchon._get_Name()] )
145
146
147
148 geompy.addToStudy(callovo, "callovo perp. 2")