Salome HOME
833ffff815e9f04901633b6ce61a69d3e885e6a3
[modules/smesh.git] / doc / salome / examples / quality_controls_ex21.py
1 # Volume
2
3 import SMESH_mechanic_tetra
4
5 smesh  = SMESH_mechanic_tetra.smesh
6 mesh   = SMESH_mechanic_tetra.mesh
7 salome = SMESH_mechanic_tetra.salome
8
9 # Criterion : VOLUME < 7.
10 volume_margin = 7.
11
12 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
13
14 anIds = mesh.GetIdsFromFilter(aFilter) 
15
16 # print the result
17 print ""
18 print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21   if j > 20: j = 1; print ""
22   print anIds[i],
23   j = j + 1
24   pass
25 print ""
26
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
29
30 aGroup.Add(anIds)
31
32 salome.sg.updateObjBrowser(1)