Back to index

salome-smesh  6.5.0
ex31_dimGroup.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 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 
00021 import sys
00022 import salome
00023 import geompy
00024 import math
00025 import SALOMEDS
00026 import SMESH
00027 import smesh
00028 
00029 salome.salome_init()
00030 aStudyId = salome.myStudy._get_StudyId()
00031 
00032 geompy.init_geom(salome.myStudy)
00033 
00034 geompy.init_geom(salome.myStudy)
00035 global Box_1
00036 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
00037 geompy.addToStudy( Box_1, "Box_1" )
00038 
00039 smesh.SetCurrentStudy(salome.myStudy)
00040 import StdMeshers
00041 Mesh_1 = smesh.Mesh(Box_1)
00042 Regular_1D = Mesh_1.Segment()
00043 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
00044 Nb_Segments_1.SetDistrType( 0 )
00045 Quadrangle_2D = Mesh_1.Quadrangle()
00046 Hexa_3D = Mesh_1.Hexahedron()
00047 isDone = Mesh_1.Compute()
00048 
00049 ### CreateDimGroup()
00050 
00051 aListOf3d_1=range(721,821)
00052 
00053 aGrp3D_1=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 1" )
00054 aGrp3D_1.Add( aListOf3d_1 )
00055 
00056 aListOf3d_2=range(821, 921)
00057 aGrp3D_2=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 2" )
00058 aGrp3D_2.Add( aListOf3d_2 )
00059 
00060 aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.FACE, "Faces" )
00061 
00062 aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.EDGE, "Edges" )
00063 
00064 aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.NODE, "Nodes" )
00065 
00066 salome.sg.updateObjBrowser( 1 )
00067