Salome HOME
Precise doc on sub-mesh priority
[modules/smesh.git] / doc / salome / examples / quality_controls_ex08.py
1 # Bare border volumes
2
3
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New()
9
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh =  smeshBuilder.New()
13 import salome_notebook
14
15
16 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
17 # the smallest face of the box
18 face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
19
20 geompy.addToStudy( box, "box" )
21 geompy.addToStudyInFather( box, face, "face" )
22
23 mesh = smesh.Mesh(box)
24 mesh.AutomaticHexahedralization();
25
26 # remove half of mesh faces from the smallest face
27 faceFaces = mesh.GetSubMeshElementsId(face)
28 faceToRemove = faceFaces[: len(faceFaces) // 2]
29 mesh.RemoveElements( faceToRemove )
30
31 # make a group of volumes missing the removed faces
32 bareGroup = mesh.MakeGroup("bare volumes", SMESH.VOLUME, SMESH.FT_BareBorderVolume)
33 assert(bareGroup.Size() == len( faceToRemove))