Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / doc / salome / examples / quality_controls_ex12.py
1 # Borders at Multiconnection 2D
2
3 import salome
4 import geompy
5
6 import smesh
7
8 # create a compound of two glued boxes
9 box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
10 box2 = geompy.MakeTranslation(box1, 0., 20., 0)
11 comp = geompy.MakeCompound([box1, box2])
12 box = geompy.MakeGlueFaces(comp, 0.000001)
13 idbox = geompy.addToStudy(box, "box")
14
15 # create a mesh
16 mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
17 algo = mesh.Segment()
18 algo.NumberOfSegments(5)
19 algo = mesh.Triangle()
20 algo.MaxElementArea(20.)
21 mesh.Compute() 
22
23 # Criterion : MULTI-CONNECTION 2D = 3
24 nb_conn = 3
25
26 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
27
28 anIds = mesh.GetIdsFromFilter(aFilter) 
29
30 # print the result
31 print "Criterion: Borders at multi-connection 2D = ", nb_conn, " 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.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
42 aGroup.Add(anIds)
43
44 salome.sg.updateObjBrowser(1)