X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Ffilters_ex01.py;h=7de1cd33addd6c138fb1a2d1abced051f20de470;hb=a17b36970bc61da1d664453c615754997c925b18;hp=88305c97f9523b52ad8809b37456bf7bf1d031a1;hpb=7a65c9fad427b1ccba6b9ccae612296e5092a324;p=modules%2Fsmesh.git diff --git a/doc/salome/examples/filters_ex01.py b/doc/salome/examples/filters_ex01.py index 88305c97f..7de1cd33a 100644 --- a/doc/salome/examples/filters_ex01.py +++ b/doc/salome/examples/filters_ex01.py @@ -1,16 +1,22 @@ # Aspect ratio +# This script demonstrates various usages of filters # create mesh from SMESH_mechanic import * -# get faces with aspect ratio > 1.5 -filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.5) +# get faces with aspect ratio > 2.5 +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 2.5) ids = mesh.GetIdsFromFilter(filter) +print "Number of faces with aspect ratio > 2.5:", len(ids) + +# get faces with aspect ratio > 1.5 +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, '>', 1.5, mesh=mesh) +ids = filter.GetIDs() print "Number of faces with aspect ratio > 1.5:", len(ids) # copy the faces with aspect ratio > 1.5 to another mesh; # this demostrates that a filter can be used where usually a group or sub-mesh is acceptable -filter.SetMesh( mesh.GetMesh() ) +filter.SetMesh( mesh.GetMesh() ) # - actually non necessary as mesh is set at filter creation mesh2 = smesh.CopyMesh( filter, "AR > 1.5" ) print "Number of copied faces with aspect ratio > 1.5:", mesh2.NbFaces()