Salome HOME
Merge from V6_main 19/03/2013
[modules/smesh.git] / doc / salome / examples / grouping_elements_ex07.py
1 # Cut of groups
2
3 import SMESH_mechanic
4
5 smesh  = SMESH_mechanic.smesh
6 mesh   = SMESH_mechanic.mesh
7 salome = SMESH_mechanic.salome
8
9 # Criterion : AREA > 20
10 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
11
12 anIds = mesh.GetIdsFromFilter(aFilter)
13
14 print "Criterion: Area > 20, Nb = ", len(anIds) 
15
16 # create a group by adding elements with area > 20
17 aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
18
19 # Criterion : AREA < 60
20 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
21
22 anIds = mesh.GetIdsFromFilter(aFilter)
23
24 print "Criterion: Area < 60, Nb = ", len(anIds) 
25
26 # create a group by adding elements with area < 60
27 aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
28  
29 # create a cut of groups : area >= 60
30 aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
31 print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())
32 # Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
33
34 salome.sg.updateObjBrowser(1)