2013-02-12 20:37:44 +06:00
|
|
|
# Edit a Group
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# Get ids of all faces with area > 35
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: Area > 35, Nb = ", len(anIds))
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a group by adding elements with area > 35
|
2013-04-04 13:08:19 +06:00
|
|
|
aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 35")
|
2013-02-12 20:37:44 +06:00
|
|
|
aGroup.Add(anIds)
|
|
|
|
|
|
|
|
# Get ids of all faces with area > 40
|
2013-04-04 13:08:19 +06:00
|
|
|
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: Area > 40, Nb = ", len(anIds))
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
|
|
|
|
aGroup.Remove(anIds)
|
2017-01-23 22:08:38 +05:00
|
|
|
aGroup.SetName("35 < Area < 40")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# print the result
|
|
|
|
aGroupElemIDs = aGroup.GetListOfID()
|
|
|
|
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs))
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
j = 1
|
|
|
|
for i in range(len(aGroupElemIDs)):
|
2017-03-20 17:27:30 +05:00
|
|
|
if j > 20: j = 1; print("")
|
|
|
|
print(aGroupElemIDs[i], end=' ')
|
2013-02-12 20:37:44 +06:00
|
|
|
j = j + 1
|
|
|
|
pass
|
2017-03-20 17:27:30 +05:00
|
|
|
print("")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2016-10-06 13:20:14 +05:00
|
|
|
salome.sg.updateObjBrowser(True)
|