smesh/doc/salome/examples/grouping_elements_ex08.py

34 lines
1.1 KiB
Python
Raw Normal View History

# Creating groups of entities basing on nodes of other groups
2013-02-12 20:37:44 +06:00
import SMESH_mechanic
2017-01-24 15:16:37 +05:00
import SMESH, SALOMEDS
2013-02-12 20:37:44 +06:00
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : AREA > 100
aFilter = smesh.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.))
print "Criterion: Area > 100, Nb = ", aSrcGroup1.Size()
2013-02-12 20:37:44 +06:00
# Criterion : AREA < 30
aFilter = smesh.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.))
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" )
2013-02-12 20:37:44 +06:00
salome.sg.updateObjBrowser(True)