smesh/doc/examples/grouping_elements_ex08.py

28 lines
1.0 KiB
Python
Raw Normal View History

# Creating groups of entities basing on nodes of other groups
2013-02-12 20:37:44 +06:00
2022-04-11 18:28:01 +05:00
from mechanic import *
import SALOMEDS
2013-02-12 20:37:44 +06:00
# Criterion : AREA > 100
2022-04-11 18:28:01 +05:00
aFilter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
2013-02-12 20:37:44 +06:00
# create a group by adding elements with area > 100
aSrcGroup1 = mesh.GroupOnFilter(SMESH.FACE, "Area > 100", aFilter)
aSrcGroup1.SetColor( SALOMEDS.Color(1.,1.,0.))
2017-03-20 17:27:30 +05:00
print("Criterion: Area > 100, Nb = ", aSrcGroup1.Size())
2013-02-12 20:37:44 +06:00
# Criterion : AREA < 30
2022-04-11 18:28:01 +05:00
aFilter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.)
2013-02-12 20:37:44 +06:00
# create a group by adding elements with area < 30
aSrcGroup2 = mesh.GroupOnFilter(SMESH.FACE, "Area < 30", aFilter)
aSrcGroup2.SetColor( SALOMEDS.Color(1.,0.,0.))
2017-03-20 17:27:30 +05:00
print("Criterion: Area < 30, Nb = ", aSrcGroup2.Size())
2013-02-12 20:37:44 +06:00
# Create group of edges using source groups of faces
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.EDGE, "Edges" )
2013-02-12 20:37:44 +06:00
# Create group of nodes using source groups of faces
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.NODE, "Nodes" )