Salome HOME
52976: Find Elements by Point - All does not find Ball element
[modules/smesh.git] / doc / salome / examples / filters_belong2group.py
1 # Belong to Mesh Group criterion
2
3 # create mesh
4 from SMESH_mechanic import *
5
6 # create a group of all faces (quadrangles) generated on sub_face3
7 faces_on_face3 = mesh.MakeGroup("faces_on_face3", SMESH.FACE, SMESH.FT_BelongToGeom,'=',sub_face3)
8 print "There are %s quadrangles generated on '%s' and included in the group '%s'" % ( faces_on_face3.Size(), sub_face3.GetName(), faces_on_face3.GetName() )
9
10 # create a group of all the rest quadrangles, generated on other faces by combining 2 criteria:
11 # - negated FT_BelongToMeshGroup to select elements not included in faces_on_face3
12 # - FT_ElemGeomType to select quadrangles
13 not_on_face3 = smesh.GetCriterion( SMESH.FACE, SMESH.FT_BelongToMeshGroup,'=',faces_on_face3, SMESH.FT_LogicalNOT )
14 quadrangles  = smesh.GetCriterion( SMESH.FACE, SMESH.FT_ElemGeomType,'=',SMESH.Geom_QUADRANGLE )
15
16 rest_quads = mesh.MakeGroupByCriteria("rest_quads", [ not_on_face3, quadrangles ])
17 print "'%s' group includes all the rest %s quadrangles" % ( rest_quads.GetName(), rest_quads.Size() )
18