Back to index

salome-smesh  6.5.0
PAL_MESH_043_2D.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_testExtrusion2D.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 #----------------------------------GEOM
00034 
00035 # create points
00036 p1 = geompy.MakeVertex(100, 0, 0)
00037 p2 = geompy.MakeVertex(100, 0, 100)
00038 p3 = geompy.MakeVertex(0, 0, 0)
00039 p4 = geompy.MakeVertex(0, 100, 0)
00040 
00041 
00042 # create two vectors
00043 vector1 = geompy.MakeVector(p1,p2)
00044 vector2 = geompy.MakeVector(p3,p4)
00045 
00046 # make two ellipses
00047 ellipse1 = geompy.MakeEllipse(p1,vector1,50,25)
00048 ellipse2 = geompy.MakeEllipse(p3,vector2,300,50)
00049 
00050 # publish circular face and second circle
00051 id_ellipse1 = geompy.addToStudy(ellipse1, "Ellips 1")
00052 id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
00053 
00054 
00055 #---------------------------------SMESH
00056 smesh.SetCurrentStudy(salome.myStudy)
00057 
00058 # create the path mesh
00059 mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
00060 
00061 algoReg1 = mesh1.Segment()
00062 algoReg1.SetName("Regular_1D")
00063 hypNbSeg1 = algoReg1.NumberOfSegments(18)
00064 smesh.SetName(hypNbSeg1, "NumberOfSegments 1")
00065 
00066 # create the tool mesh
00067 mesh2 = smesh.Mesh(ellipse2, "Tool Mesh")
00068 algoReg2 = mesh2.Segment()
00069 algoReg2.SetName("Regular_1D")
00070 hypNbSeg2 = algoReg2.NumberOfSegments(34)
00071 smesh.SetName(hypNbSeg2, "NumberOfSegments 2")
00072 
00073 # compute meshes
00074 mesh1.Compute()
00075 mesh2.Compute()
00076 
00077 
00078 # ---- udate object browser
00079 salome.sg.updateObjBrowser(1);