Salome HOME
Porting to Python 2.6 - add coding page specification for Python scripts
[modules/smesh.git] / src / SMESH_SWIG / ex17_dome1.py
1 #! /usr/bin/python
2 #  -*- coding: iso-8859-1 -*-
3 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
5 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 #
8 #  This library is free software; you can redistribute it and/or
9 #  modify it under the terms of the GNU Lesser General Public
10 #  License as published by the Free Software Foundation; either
11 #  version 2.1 of the License.
12 #
13 #  This library is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 #  Lesser General Public License for more details.
17 #
18 #  You should have received a copy of the GNU Lesser General Public
19 #  License along with this library; if not, write to the Free Software
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 #
22 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #
24 # =======================================
25 #
26 from geompy import *
27
28 import smesh
29
30 # Geometrie
31 # =========
32
33 # Creer un cylindre surplombe d'une demi-sphere le tout troue par un petit cylindre.
34 # Decouper en hexahedre et mailler.
35
36 # Donnees
37 # -------
38
39 cylindre_rayon   = 100
40 cylindre_hauteur = 400
41
42 trou_rayon = 20
43 trou_z     = cylindre_rayon/2
44
45 plan_trim = 2000
46
47 # Cylindre
48 # --------
49
50 cylindre_base = MakeVertex(0, 0, 0)
51 cylindre_dir  = MakeVectorDXDYDZ(1, 0, 0)
52 cylindre      = MakeCylinder(cylindre_base, cylindre_dir, cylindre_rayon, cylindre_hauteur)
53
54 # Dome
55 # ----
56
57 dome_sphere = MakeSpherePntR(cylindre_base, cylindre_rayon)
58 dome        = MakeFuse(dome_sphere, cylindre)
59
60 # Cheminee
61 # --------
62
63 cheminee_base = MakeVertex(-cylindre_hauteur/2, 0, trou_z)
64 cheminee_trou = MakeCylinder(cheminee_base, cylindre_dir, trou_rayon, 2*cylindre_hauteur)
65 cheminee      = MakeCut(dome, cheminee_trou)
66
67 # Decoupage et reparation
68 # -----------------------
69
70 blocs_plan1 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 1, 0), plan_trim)
71 blocs_plan2 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 0, 1), plan_trim)
72
73 blocs_part = MakePartition([cheminee], [blocs_plan1, blocs_plan2], [], [], ShapeType["SOLID"])
74
75 piece = RemoveExtraEdges(blocs_part)
76
77 # Etude
78 # -----
79
80 piece_id = addToStudy(piece, "ex17_dome1")
81
82 # Maillage
83 # ========
84
85 # Maillage hexahedrique
86 # ---------------------
87
88 hexa = smesh.Mesh(piece, "ex17_dome1:hexa")
89
90 algo = hexa.Segment()
91 algo.NumberOfSegments(20)
92
93 hexa.Quadrangle()
94
95 hexa.Hexahedron()
96
97 # Calcul du maillage
98 # ------------------
99
100 hexa.Compute()