smesh/doc/examples/transforming_meshes_ex08.py

43 lines
1.2 KiB
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Sew Conform Free Borders
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 the box
2022-04-11 18:28:01 +05:00
box1 = geom_builder.MakeBox(0., 0., -10., 20., 20., 15.)
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()
if not mesh.Compute(): raise Exception("Error when computing Mesh")
2013-02-12 20:37:44 +06:00
# sew conform free borders
# FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2
mesh.SewConformFreeBorders(5, 45, 6, 3, 24)