Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / SMESH_SWIG / SMESH_GroupLyingOnGeom.py
1 #  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 #
4 #  This library is free software; you can redistribute it and/or
5 #  modify it under the terms of the GNU Lesser General Public
6 #  License as published by the Free Software Foundation; either
7 #  version 2.1 of the License.
8 #
9 #  This library is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 #  Lesser General Public License for more details.
13 #
14 #  You should have received a copy of the GNU Lesser General Public
15 #  License along with this library; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 import smesh
21
22 def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
23     aFilterMgr = smesh.smesh.CreateFilterManager()
24     aFilter = aFilterMgr.CreateFilter()
25    
26     aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
27     aLyingOnGeom.SetGeom(theShape)
28     aLyingOnGeom.SetElementType(theElemType)
29     
30     aFilter.SetPredicate(aLyingOnGeom)
31     anIds = aFilter.GetElementsId(theMesh)
32
33     aGroup = theMesh.CreateGroup(theElemType, theName)
34     aGroup.Add(anIds)
35
36 #Example
37 from SMESH_test1 import *
38
39 mesh.Compute()
40
41 # First way
42 BuildGroupLyingOn(mesh.GetMesh(), smesh.FACE, "Group of faces lying on edge #1", edge )
43
44 # Second way
45 mesh.MakeGroup("Group of faces lying on edge #2", smesh.FACE, smesh.FT_LyingOnGeom, edge)
46
47 salome.sg.updateObjBrowser(1);