Salome HOME
Fix bug 12796: Warning missed for the bad file 'test18.med'
[modules/smesh.git] / src / SMESH_SWIG / ex17_dome1.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 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
21 # =======================================
22
23 from geompy import *
24
25 import smesh
26
27 # Geometrie
28 # =========
29
30 # Creer un cylindre surplombe d'une demi-sphere le tout troue par un petit cylindre.
31 # Decouper en hexahedre et mailler.
32
33 # Donnees
34 # -------
35
36 cylindre_rayon   = 100
37 cylindre_hauteur = 400
38
39 trou_rayon = 20
40 trou_z     = cylindre_rayon/2
41
42 plan_trim = 2000
43
44 # Cylindre
45 # --------
46
47 cylindre_base = MakeVertex(0, 0, 0)
48 cylindre_dir  = MakeVectorDXDYDZ(1, 0, 0)
49 cylindre      = MakeCylinder(cylindre_base, cylindre_dir, cylindre_rayon, cylindre_hauteur)
50
51 # Dome
52 # ----
53
54 dome_sphere = MakeSpherePntR(cylindre_base, cylindre_rayon)
55 dome        = MakeFuse(dome_sphere, cylindre)
56
57 # Cheminee
58 # --------
59
60 cheminee_base = MakeVertex(-cylindre_hauteur/2, 0, trou_z)
61 cheminee_trou = MakeCylinder(cheminee_base, cylindre_dir, trou_rayon, 2*cylindre_hauteur)
62 cheminee      = MakeCut(dome, cheminee_trou)
63
64 # Decoupage et reparation
65 # -----------------------
66
67 blocs_plan1 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 1, 0), plan_trim)
68 blocs_plan2 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 0, 1), plan_trim)
69
70 blocs_part = MakePartition([cheminee], [blocs_plan1, blocs_plan2], [], [], ShapeType["SOLID"])
71
72 piece = RemoveExtraEdges(blocs_part)
73
74 # Etude
75 # -----
76
77 piece_id = addToStudy(piece, "ex17_dome1")
78
79 # Maillage
80 # ========
81
82 # Maillage hexahedrique
83 # ---------------------
84
85 hexa = smesh.Mesh(piece, "ex17_dome1:hexa")
86
87 algo = hexa.Segment()
88 algo.NumberOfSegments(20)
89
90 hexa.Quadrangle()
91
92 hexa.Hexahedron()
93
94 # Calcul du maillage
95 # ------------------
96
97 hexa.Compute()