2013-02-12 20:37:44 +06:00
|
|
|
# Borders at Multiconnection 2D
|
|
|
|
|
|
|
|
import salome
|
2021-08-12 14:38:10 +05:00
|
|
|
salome.salome_init_without_session()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
import SMESH
|
|
|
|
from salome.geom import geomBuilder
|
2013-04-04 13:08:19 +06:00
|
|
|
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
|
|
|
|
|
|
|
# create a compound of two glued boxes
|
2022-04-11 18:28:01 +05:00
|
|
|
box1 = geom_builder.MakeBox(0., 0., 0., 20., 20., 15.)
|
|
|
|
box2 = geom_builder.MakeTranslation(box1, 0., 20., 0)
|
|
|
|
comp = geom_builder.MakeCompound([box1, box2])
|
|
|
|
box = geom_builder.MakeGlueFaces(comp, 0.000001)
|
|
|
|
idbox = geom_builder.addToStudy(box, "box")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a mesh
|
2022-04-11 18:28:01 +05:00
|
|
|
mesh = smesh_builder.Mesh(box, "Box compound : 2D triangle mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
algo = mesh.Segment()
|
|
|
|
algo.NumberOfSegments(5)
|
|
|
|
algo = mesh.Triangle()
|
|
|
|
algo.MaxElementArea(20.)
|
2023-02-21 18:59:44 +05:00
|
|
|
if not mesh.Compute(): raise Exception("Error when computing Mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# Criterion : MULTI-CONNECTION 2D = 3
|
|
|
|
nb_conn = 3
|
|
|
|
|
2022-04-11 18:28:01 +05:00
|
|
|
aFilter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_EqualTo, nb_conn)
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
anIds = mesh.GetIdsFromFilter(aFilter)
|
|
|
|
|
|
|
|
# print the result
|
2017-03-20 17:27:30 +05:00
|
|
|
print("Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds))
|
2013-02-12 20:37:44 +06:00
|
|
|
j = 1
|
|
|
|
for i in range(len(anIds)):
|
2017-03-20 17:27:30 +05:00
|
|
|
if j > 20: j = 1; print("")
|
|
|
|
print(anIds[i], end=' ')
|
2013-02-12 20:37:44 +06:00
|
|
|
j = j + 1
|
|
|
|
pass
|
2017-03-20 17:27:30 +05:00
|
|
|
print("")
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a group
|
2017-03-20 17:27:30 +05:00
|
|
|
aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Borders at multi-connection 2D = " + repr(nb_conn))
|
2013-02-12 20:37:44 +06:00
|
|
|
aGroup.Add(anIds)
|