Salome HOME
c25638cc5faa9c16769f7c284150d72e8f2f6efd
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition4.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_Partition4.py
26 #  Module : GEOM
27 # import couplex2_01_GEOM
28 # reload(couplex2_01_GEOM)
29 # Dimensions de alveolus
30 # Parall�pip�de rectangle de taille alDx, alDy, alDz
31 #
32 alDx   = 2.5
33 alDy   = 20.0
34 alDz   = 2.5
35 alSepx = 18.0
36
37 # Dimensions de backfill
38 # Parall�pip�de rectangle de taille baDx, baDy, baDz
39
40 baDx = 27.0
41 baDy = 4.8
42 baDz = 4.8
43
44 # Dimensions de geological medium
45
46 gmDx = baDx
47 gmDy = 49.6
48 gmDz = 100.0
49
50 # --
51
52 import salome
53 salome.salome_init()
54 import GEOM
55 from salome.geom import geomBuilder
56 geompy = geomBuilder.New()
57
58 # -- Construction de backfill
59
60 backA = geompy.MakeBox(0.0, 0.0, 0.0, baDx, baDy, baDz)
61 back = geompy.MakeTranslation(backA, -baDx/2, -baDy/2, -baDz/2)
62
63 # -- Construction de alveolus
64
65 import math
66
67 alveA = geompy.MakeBox(0.0, 0.0, 0.0, alDx, alDy, alDz)
68 alveB = geompy.MakeTranslation(alveA, -alDx/2, baDy/2, -alDz/2)
69 axis  = geompy.MakeVectorDXDYDZ(1.0, 0.0, 0.0)
70 alve1 = geompy.MakeRotation(alveB, axis, math.pi)
71 alve2 = geompy.MakeTranslation(alveB, +alSepx/2, 0.0, 0.0)
72 alve3 = geompy.MakeTranslation(alveB, -alSepx/2, 0.0, 0.0)
73 GOlist = []
74 GOlist.append(alve1)
75 GOlist.append(alve2)
76 GOlist.append(alve3)
77 alve = geompy.MakeCompound(GOlist)
78
79 # -- Construction de geological medium
80
81 geolA = geompy.MakeBox(0.0, 0.0, 0.0, gmDx, gmDy, gmDz)
82 geol = geompy.MakeTranslation(geolA, -gmDx/2, -gmDy/2, -gmDz/2)
83
84 geol = geompy.MakePartition([alve, geol, back])
85
86 subshapes = geompy.SubShapeAll(geol, geompy.ShapeType["SHAPE"])
87
88 GOlist = []
89 GOlist.append(subshapes[0])
90 GOlist.append(subshapes[1])
91 GOlist.append(subshapes[2])
92 alve = geompy.MakeCompound(GOlist)
93
94 geol = subshapes[3]
95 back = subshapes[4]
96
97 # --
98
99 geol = geompy.MakeCompound([geol, back, alve])
100
101 geompy.addToStudy(geol, "couplex2 2")