2013-02-12 20:37:44 +06:00
|
|
|
# Intersection of groups
|
|
|
|
|
|
|
|
import SMESH_mechanic
|
2013-04-04 13:08:19 +06:00
|
|
|
import SMESH
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
smesh = SMESH_mechanic.smesh
|
|
|
|
mesh = SMESH_mechanic.mesh
|
|
|
|
salome = SMESH_mechanic.salome
|
|
|
|
|
|
|
|
# Criterion : AREA > 20
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: Area > 20, Nb = ", len(anIds))
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a group by adding elements with area > 20
|
2013-04-04 13:08:19 +06:00
|
|
|
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
|
2013-02-12 20:37:44 +06:00
|
|
|
aGroup1.Add(anIds)
|
|
|
|
|
|
|
|
# Criterion : AREA < 60
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: Area < 60, Nb = ", len(anIds))
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a group by adding elements with area < 60
|
2013-04-04 13:08:19 +06:00
|
|
|
aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
|
2013-02-12 20:37:44 +06:00
|
|
|
aGroup2.Add(anIds)
|
|
|
|
|
|
|
|
# create an intersection of groups : 20 < area < 60
|
|
|
|
aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60")
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID()))
|
2013-02-12 20:37:44 +06:00
|
|
|
# Please note that also there is IntersectGroups() method which works with two groups only
|
|
|
|
|
2016-10-06 13:20:14 +05:00
|
|
|
salome.sg.updateObjBrowser(True)
|