1 # Create a Group on Filter
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New()
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New()
13 import salome_notebook
16 box = geompy.MakeBoxDXDYDZ(10,10,10)
18 # make a mesh with quadrangles of different area in range [1,16]
19 mesh = smesh.Mesh(box,"Quad mesh")
20 hyp1D = mesh.Segment().StartEndLength( 1, 4 )
24 # create a group on filter selecting faces of medium size
26 smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, ">", 1.1, BinaryOp=SMESH.FT_LogicalAND ),
27 smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, "<", 15.0 )
29 filt = smesh.GetFilterFromCriteria( critaria )
30 filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt )
31 print("Group on filter contains %s elements" % filtGroup.Size())
33 # group on filter is updated if the mesh is modified
34 hyp1D.SetStartLength( 2.5 )
35 hyp1D.SetEndLength( 2.5 )
37 print("After mesh change, group on filter contains %s elements" % filtGroup.Size())
39 # set a new filter defining the group
40 filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds, "1-50" )
41 filtGroup.SetFilter( filt2 )
42 print("With a new filter, group on filter contains %s elements" % filtGroup.Size())
44 # group is updated at modification of the filter
45 filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )])
46 filtIDs3 = filtGroup.GetIDs()
47 print("After filter modification, group on filter contains %s elements" % filtGroup.Size())
49 salome.sg.updateObjBrowser()