smesh/doc/examples/quality_controls_ex08.py

31 lines
911 B
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Bare border volumes
import salome
salome.salome_init_without_session()
2022-04-11 18:28:01 +05:00
import SMESH
from salome.geom import geomBuilder
from salome.smesh import smeshBuilder
2022-04-11 18:28:01 +05:00
geom_builder = geomBuilder.New()
smesh_builder = smeshBuilder.New()
2013-02-12 20:37:44 +06:00
2022-04-11 18:28:01 +05:00
box = geom_builder.MakeBoxDXDYDZ(100, 30, 10)
2013-02-12 20:37:44 +06:00
# the smallest face of the box
2022-04-11 18:28:01 +05:00
face = geom_builder.SubShapeAllSorted( box, geom_builder.ShapeType["FACE"])[0]
2013-02-12 20:37:44 +06:00
2022-04-11 18:28:01 +05:00
geom_builder.addToStudy( box, "box" )
geom_builder.addToStudyInFather( box, face, "face" )
2013-02-12 20:37:44 +06:00
2022-04-11 18:28:01 +05:00
mesh = smesh_builder.Mesh(box)
2013-02-12 20:37:44 +06:00
mesh.AutomaticHexahedralization();
# remove half of mesh faces from the smallest face
faceFaces = mesh.GetSubMeshElementsId(face)
2017-03-29 19:58:59 +05:00
faceToRemove = faceFaces[: len(faceFaces) // 2]
2013-02-12 20:37:44 +06:00
mesh.RemoveElements( faceToRemove )
# make a group of volumes missing the removed faces
bareGroup = mesh.MakeGroup("bare volumes", SMESH.VOLUME, SMESH.FT_BareBorderVolume)
2013-02-12 20:37:44 +06:00
assert(bareGroup.Size() == len( faceToRemove))