Salome HOME
Merge from V6_main 01/04/2013
[modules/smesh.git] / doc / salome / examples / quality_controls_ex02.py
1 # Borders at Multiconnection
2
3 import salome
4 import geompy
5
6 import smesh
7 import SMESH
8
9 # create open shell: a box without one plane
10 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
11 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
12 FaceList.remove(FaceList[5])
13 box = geompy.MakeShell(FaceList)
14 idbox = geompy.addToStudy(box, "box")
15
16 # create a mesh
17 mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
18 algo = mesh.Segment()
19 algo.NumberOfSegments(5)
20 algo = mesh.Triangle()
21 algo.MaxElementArea(20.)
22 mesh.Compute() 
23
24 # Criterion : Borders at multi-connection
25 nb_conn = 2
26
27 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
28 anIds = mesh.GetIdsFromFilter(aFilter)
29
30 # print the result
31 print "Criterion: Borders at multi-connections Nb = ", len(anIds)
32 j = 1
33 for i in range(len(anIds)):
34   if j > 20: j = 1; print ""
35   print anIds[i],
36   j = j + 1
37   pass
38 print ""
39
40 # create a group
41 aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Borders at multi-connections")
42 aGroup.Add(anIds)
43
44 salome.sg.updateObjBrowser(1)