smesh/doc/salome/examples/quality_controls_ex02.py

50 lines
1.2 KiB
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Borders at Multiconnection
2013-02-12 20:37:44 +06:00
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
2017-06-13 15:01:10 +05:00
geompy = geomBuilder.New()
2013-02-12 20:37:44 +06:00
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
2017-06-13 15:01:10 +05:00
smesh = smeshBuilder.New()
2013-02-12 20:37:44 +06:00
# create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
FaceList.remove(FaceList[5])
box = geompy.MakeShell(FaceList)
idbox = geompy.addToStudy(box, "box")
# create a mesh
mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
algo = mesh.Segment()
algo.NumberOfSegments(5)
algo = mesh.Triangle()
algo.MaxElementArea(20.)
mesh.Compute()
# Criterion : Borders at multi-connection
nb_conn = 2
aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn)
2013-02-12 20:37:44 +06:00
anIds = mesh.GetIdsFromFilter(aFilter)
# print the result
print "Criterion: Borders at multi-connections Nb = ", len(anIds)
j = 1
for i in range(len(anIds)):
if j > 20: j = 1; print ""
print anIds[i],
j = j + 1
pass
print ""
# create a group
aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Borders at multi-connections")
2013-02-12 20:37:44 +06:00
aGroup.Add(anIds)
2017-06-13 15:01:10 +05:00
salome.sg.updateObjBrowser()