2013-02-12 20:37:44 +06:00
|
|
|
# Union of groups
|
|
|
|
|
|
|
|
import SMESH_mechanic
|
2017-01-24 15:16:37 +05:00
|
|
|
import SMESH, SALOMEDS
|
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)
|
|
|
|
|
|
|
|
print "Criterion: Area > 20, Nb = ", len( anIds )
|
|
|
|
|
|
|
|
# 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 = 20
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
|
|
|
print "Criterion: Area = 20, Nb = ", len( anIds )
|
|
|
|
|
|
|
|
# create a group by adding elements with area = 20
|
2013-04-04 13:08:19 +06:00
|
|
|
aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" )
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
aGroup2.Add(anIds)
|
|
|
|
|
|
|
|
# create union group : area >= 20
|
|
|
|
aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
|
2017-01-23 22:08:38 +05:00
|
|
|
aGroup3.SetColor( SALOMEDS.Color(1.,1.,0.));
|
2013-02-12 20:37:44 +06:00
|
|
|
print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
|
|
|
|
# Please note that also there is UnionGroups() method which works with two groups only
|
|
|
|
|
|
|
|
# Criterion : AREA < 20
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
|
|
|
print "Criterion: Area < 20, Nb = ", len(anIds)
|
|
|
|
|
|
|
|
# create a group by adding elements with area < 20
|
2013-04-04 13:08:19 +06:00
|
|
|
aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20")
|
2013-02-12 20:37:44 +06:00
|
|
|
aGroup4.Add(anIds)
|
2017-01-23 22:08:38 +05:00
|
|
|
aGroup4.SetColor( SALOMEDS.Color(1.,0.,0.));
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create union group : area >= 20 and area < 20
|
|
|
|
aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
|
|
|
|
print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())
|
|
|
|
|
2016-10-06 13:20:14 +05:00
|
|
|
salome.sg.updateObjBrowser(True)
|