smesh/doc/examples/transforming_meshes_ex07.py

45 lines
1.2 KiB
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Sew Meshes Border to Side
import salome
salome.salome_init_without_session()
2022-04-11 18:28:01 +05:00
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
# create two faces of a box
2022-04-11 18:28:01 +05:00
box1 = geom_builder.MakeBox(0., 0., -10., 30., 20., 25.)
facesList1 = geom_builder.SubShapeAll(box1, geom_builder.ShapeType["FACE"])
2013-02-12 20:37:44 +06:00
face1 = facesList1[2]
2022-04-11 18:28:01 +05:00
box2 = geom_builder.MakeBox(0., 5., 0., 20., 20., 15.)
facesList2 = geom_builder.SubShapeAll(box2, geom_builder.ShapeType["FACE"])
2013-02-12 20:37:44 +06:00
face2 = facesList2[1]
2022-04-11 18:28:01 +05:00
edgesList = geom_builder.SubShapeAll(face2, geom_builder.ShapeType["EDGE"])
2013-02-12 20:37:44 +06:00
edge1 = edgesList[2]
2022-04-11 18:28:01 +05:00
aComp = geom_builder.MakeCompound([face1, face2])
geom_builder.addToStudy(aComp, "Two faces")
2013-02-12 20:37:44 +06:00
# create a mesh on two faces
2022-04-11 18:28:01 +05:00
mesh = smesh_builder.Mesh(aComp, "Two faces : quadrangle mesh")
2013-02-12 20:37:44 +06:00
algo1D = mesh.Segment()
algo1D.NumberOfSegments(9)
algo2D = mesh.Quadrangle()
algo_local = mesh.Segment(edge1)
algo_local.Arithmetic1D(1, 4)
algo_local.Propagation()
mesh.Compute()
# sew border to side
# FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
# FirstNodeIDOnSide, LastNodeIDOnSide,
# CreatePolygons, CreatePolyedrs
mesh.SewBorderToSide(5, 45, 6, 113, 109, 0, 0)