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