5 smesh = SMESH_mechanic.smesh
6 mesh = SMESH_mechanic.mesh
7 salome = SMESH_mechanic.salome
9 # Criterion : AREA > 20
10 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
12 anIds = mesh.GetIdsFromFilter(aFilter)
14 print "Criterion: Area > 20, Nb = ", len(anIds)
16 # create a group by adding elements with area > 20
17 aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
19 # Criterion : AREA < 60
20 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
22 anIds = mesh.GetIdsFromFilter(aFilter)
24 print "Criterion: Area < 60, Nb = ", len(anIds)
26 # create a group by adding elements with area < 60
27 aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
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
34 salome.sg.updateObjBrowser(1)