2013-02-12 20:37:44 +06:00
|
|
|
# Cut 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
|
|
|
aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# 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
|
|
|
aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a cut of groups : area >= 60
|
|
|
|
aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID()))
|
2013-02-12 20:37:44 +06:00
|
|
|
# Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths
|
|
|
|
|
2017-06-13 15:01:10 +05:00
|
|
|
salome.sg.updateObjBrowser()
|