smesh/doc/salome/examples/grouping_elements_ex07.py

36 lines
1.1 KiB
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Cut of groups
import SMESH_mechanic
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
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
aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds)
2013-02-12 20:37:44 +06:00
# Criterion : AREA < 60
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
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
salome.sg.updateObjBrowser(True)