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 = 20
22 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.)
24 anIds = mesh.GetIdsFromFilter(aFilter)
26 print "Criterion: Area = 20, Nb = ", len( anIds )
28 # create a group by adding elements with area = 20
29 aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" )
33 # create union group : area >= 20
34 aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
35 print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
36 # Please note that also there is UnionGroups() method which works with two groups only
38 # Criterion : AREA < 20
39 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.)
41 anIds = mesh.GetIdsFromFilter(aFilter)
43 print "Criterion: Area < 20, Nb = ", len(anIds)
45 # create a group by adding elements with area < 20
46 aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20")
49 # create union group : area >= 20 and area < 20
50 aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
51 print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
53 salome.sg.updateObjBrowser(1)