smesh/doc/examples/grouping_elements_ex07.py

29 lines
955 B
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Cut of groups
2022-04-11 18:28:01 +05:00
from mechanic import *
2013-02-12 20:37:44 +06:00
# Criterion : AREA > 20
2022-04-11 18:28:01 +05:00
aFilter = smesh_builder.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
2022-04-11 18:28:01 +05:00
aFilter = smesh_builder.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