Back to index

salome-smesh  6.5.0
PAL_MESH_043_3D.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 #  File        : SMESH_testExtrusion3D.py
00025 #  Module      : SMESH
00026 #  Description : Create meshes to test extrusion of mesh elements along path
00027 #
00028 import salome
00029 import geompy
00030 import smesh
00031 
00032 
00033 # create points to build two circles
00034 p1 = geompy.MakeVertex(0,  100,  0)
00035 p2 = geompy.MakeVertex(100,  0,  0)
00036 p3 = geompy.MakeVertex(0, -100,  0)
00037 p4 = geompy.MakeVertex(0,   70,  0)
00038 p5 = geompy.MakeVertex(0,  100, 30)
00039 p6 = geompy.MakeVertex(0,  130,  0)
00040 
00041 # create two circles
00042 circle = geompy.MakeCircleThreePnt(p1, p2, p3)
00043 cf     = geompy.MakeCircleThreePnt(p4, p5, p6)
00044 
00045 # make circular face
00046 wire = geompy.MakeWire([cf])
00047 face = geompy.MakeFace(wire, 1)
00048 
00049 # publish circular face and second circle
00050 idcircle = geompy.addToStudy(circle, "Circle")
00051 idface   = geompy.addToStudy(face,   "Circular face")
00052 
00053 
00054 smesh.SetCurrentStudy(salome.myStudy)
00055 
00056 # init a Mesh with the circular face
00057 mesh1 = smesh.Mesh(face, "Mesh on circular face")
00058 
00059 # set hypotheses and algos to the first mesh
00060 numberOfSegments1 = 12
00061 algoReg1 = mesh1.Segment()
00062 algoReg1.SetName("Regular_1D")
00063 hypNbSeg1 = algoReg1.NumberOfSegments(numberOfSegments1)
00064 smesh.SetName(hypNbSeg1, "NumberOfSegments_" + str(numberOfSegments1))
00065 
00066 maxElementArea = 30
00067 
00068 algoMef = mesh1.Triangle()
00069 algoMef.SetName("MEFISTO_2D")
00070 hypArea = algoMef.MaxElementArea(maxElementArea)
00071 smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
00072 
00073 
00074 # init a Mesh with the second circle
00075 mesh2 = smesh.Mesh(circle, "Mesh on circular edge")
00076 
00077 numberOfSegments2 = 12
00078 algoReg2 = mesh2.Segment()
00079 algoReg2.SetName("Regular_1D")
00080 hypNbSeg2 = algoReg2.NumberOfSegments(numberOfSegments2)
00081 smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2))
00082 
00083 
00084 # compute meshes
00085 mesh1.Compute()
00086 mesh2.Compute()
00087 
00088 # ---- udate object browser
00089 salome.sg.updateObjBrowser(1);