1 # Intersection of groups
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
10 # Criterion : AREA > 20
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
15 print("Criterion: Area > 20, Nb = ", len(anIds))
17 # create a group by adding elements with area > 20
18 aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
21 # Criterion : AREA < 60
22 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
24 anIds = mesh.GetIdsFromFilter(aFilter)
26 print("Criterion: Area < 60, Nb = ", len(anIds))
28 # create a group by adding elements with area < 60
29 aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
32 # create an intersection of groups : 20 < area < 60
33 aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
34 print("Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID()))
35 # Please note that also there is IntersectGroups() method which works with two groups only
37 salome.sg.updateObjBrowser()