Back to index

salome-smesh  6.5.0
SMESH_box.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 #  Info.
00026 #  Bug (from script, bug)   : box.py, PAL5223
00027 #  Modified                 : 25/11/2004
00028 #  Author                   : Kovaltchuk Alexey
00029 #  Project                  : PAL/SALOME
00030 #==============================================================================
00031 # Salome geometry and meshing for a box
00032 #
00033 import salome
00034 from salome import sg
00035 import geompy
00036 import smesh
00037 
00038 
00039 # ---- launch GEOM
00040 
00041 geom          = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
00042 
00043 ###geom.GetCurrentStudy(salome.myStudy._get_StudyId())
00044 
00045 # Plate
00046 
00047 box    = geompy.MakeBox(0.,0.,0.,1.,1.,1.)
00048 boxId  = geompy.addToStudy(box,"box")
00049 
00050 # ---- SMESH
00051 smesh.SetCurrentStudy(salome.myStudy)
00052 
00053 # ---- init a Mesh
00054 
00055 box_mesh=smesh.Mesh(box, "box_mesh")
00056 
00057 # set Hypothesis and Algorithm
00058 
00059 alg1D = box_mesh.Segment()
00060 alg1D.SetName("algo1D")
00061 hypL1 = alg1D.LocalLength(0.25)
00062 smesh.SetName(hypL1, "LocalLength")
00063     
00064 alg2D = box_mesh.Quadrangle()
00065 alg2D.SetName("algo2D")
00066 
00067 alg3D = box_mesh.Hexahedron()
00068 alg3D.SetName("algo3D")
00069 
00070 # compute mesh
00071 
00072 box_mesh.Compute()
00073 
00074 sg.updateObjBrowser(1)