smesh/doc/salome/examples/quality_controls_ex04.py

41 lines
1.0 KiB
Python
Raw Permalink Normal View History

2013-02-12 20:37:44 +06:00
# Free Edges
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
aFilterMgr = smesh.CreateFilterManager()
# Remove some elements to obtain free edges
# Criterion : AREA > 95.
area_margin = 95.
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
2013-02-12 20:37:44 +06:00
anIds = mesh.GetIdsFromFilter(aFilter)
mesh.RemoveElements(anIds)
# Criterion : Free Edges
aBorders = mesh.GetFreeBorders()
# create groups
aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges")
aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges")
2013-02-12 20:37:44 +06:00
# fill groups with elements, corresponding to the criterion
2017-03-20 17:27:30 +05:00
print("")
print("Criterion: Free edges Nb = ", len(aBorders))
2013-02-12 20:37:44 +06:00
for i in range(len(aBorders)):
aBorder = aBorders[i]
2017-03-20 17:27:30 +05:00
print("Face # ", aBorder.myElemId, " : Edge between nodes (", end=' ')
print(aBorder.myPnt1, ", ", aBorder.myPnt2, ")")
2013-02-12 20:37:44 +06:00
aGroupF.Add([aBorder.myElemId])
aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
2017-06-13 15:01:10 +05:00
salome.sg.updateObjBrowser()