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