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