]> SALOME platform Git repositories - modules/smesh.git/blob - doc/salome/examples/quality_controls_ex01.py
Salome HOME
update of messages
[modules/smesh.git] / doc / salome / examples / quality_controls_ex01.py
1 # Free Borders
2
3
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh =  smeshBuilder.New(salome.myStudy)
13
14 # create open shell: a box without one plane
15 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
16 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
17 FaceList.remove(FaceList[5])
18 box = geompy.MakeShell(FaceList)
19 idbox = geompy.addToStudy(box, "box")
20
21 # create a mesh
22 mesh = smesh.Mesh(box, "Mesh_free_borders")
23 algo = mesh.Segment()
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
27 mesh.Compute() 
28
29 # criterion : free borders
30 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
31 anIds = mesh.GetIdsFromFilter(aFilter)
32
33 # print the result
34 print "Criterion: Free borders Nb = ", len(anIds)
35 j = 1
36 for i in range(len(anIds)):
37   if j > 20: j = 1; print ""
38   print anIds[i],
39   j = j + 1
40   pass
41 print ""
42
43 # create a group
44 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders")
45 aGroup.Add(anIds)
46
47 salome.sg.updateObjBrowser(1)