Back to index

salome-smesh  6.5.0
ex17_dome1.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 # =======================================
00025 #
00026 from geompy import *
00027 
00028 import smesh
00029 
00030 # Geometrie
00031 # =========
00032 
00033 # Creer un cylindre surplombe d'une demi-sphere le tout troue par un petit cylindre.
00034 # Decouper en hexahedre et mailler.
00035 
00036 # Donnees
00037 # -------
00038 
00039 cylindre_rayon   = 100
00040 cylindre_hauteur = 400
00041 
00042 trou_rayon = 20
00043 trou_z     = cylindre_rayon/2
00044 
00045 plan_trim = 2000
00046 
00047 # Cylindre
00048 # --------
00049 
00050 cylindre_base = MakeVertex(0, 0, 0)
00051 cylindre_dir  = MakeVectorDXDYDZ(1, 0, 0)
00052 cylindre      = MakeCylinder(cylindre_base, cylindre_dir, cylindre_rayon, cylindre_hauteur)
00053 
00054 # Dome
00055 # ----
00056 
00057 dome_sphere = MakeSpherePntR(cylindre_base, cylindre_rayon)
00058 dome        = MakeFuse(dome_sphere, cylindre)
00059 
00060 # Cheminee
00061 # --------
00062 
00063 cheminee_base = MakeVertex(-cylindre_hauteur/2, 0, trou_z)
00064 cheminee_trou = MakeCylinder(cheminee_base, cylindre_dir, trou_rayon, 2*cylindre_hauteur)
00065 cheminee      = MakeCut(dome, cheminee_trou)
00066 
00067 # Decoupage et reparation
00068 # -----------------------
00069 
00070 blocs_plan1 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 1, 0), plan_trim)
00071 blocs_plan2 = MakePlane(cheminee_base, MakeVectorDXDYDZ(0, 0, 1), plan_trim)
00072 
00073 blocs_part = MakePartition([cheminee], [blocs_plan1, blocs_plan2], [], [], ShapeType["SOLID"])
00074 
00075 piece = RemoveExtraEdges(blocs_part)
00076 
00077 # Etude
00078 # -----
00079 
00080 piece_id = addToStudy(piece, "ex17_dome1")
00081 
00082 # Maillage
00083 # ========
00084 
00085 smesh.SetCurrentStudy(salome.myStudy)
00086 
00087 # Maillage hexahedrique
00088 # ---------------------
00089 
00090 hexa = smesh.Mesh(piece, "ex17_dome1:hexa")
00091 
00092 algo = hexa.Segment()
00093 algo.NumberOfSegments(20)
00094 
00095 hexa.Quadrangle()
00096 
00097 hexa.Hexahedron()
00098 
00099 # Calcul du maillage
00100 # ------------------
00101 
00102 hexa.Compute()