smesh/doc/examples/defining_hypotheses_ex05.py

44 lines
1001 B
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Maximum Element Area
import salome
salome.salome_init_without_session()
2022-04-13 12:01:14 +05:00
from salome.geom import geomBuilder
from salome.smesh import smeshBuilder
2022-04-13 12:01:14 +05:00
geom_builder = geomBuilder.New()
smesh_builder = smeshBuilder.New()
2013-02-12 20:37:44 +06:00
# create a face
2022-04-13 12:01:14 +05:00
px = geom_builder.MakeVertex(100., 0. , 0. )
py = geom_builder.MakeVertex(0. , 100., 0. )
pz = geom_builder.MakeVertex(0. , 0. , 100.)
2013-02-12 20:37:44 +06:00
2022-04-13 12:01:14 +05:00
vxy = geom_builder.MakeVector(px, py)
arc = geom_builder.MakeArc(py, pz, px)
wire = geom_builder.MakeWire([vxy, arc])
2013-02-12 20:37:44 +06:00
isPlanarFace = 1
2022-04-13 12:01:14 +05:00
face = geom_builder.MakeFace(wire, isPlanarFace)
2013-02-12 20:37:44 +06:00
# add the face in the study
2022-04-13 12:01:14 +05:00
id_face = geom_builder.addToStudy(face, "Face to be meshed")
2013-02-12 20:37:44 +06:00
# create a mesh
2022-04-13 12:01:14 +05:00
tria_mesh = smesh_builder.Mesh(face, "Face : triangulation")
2013-02-12 20:37:44 +06:00
# define 1D meshing:
algo = tria_mesh.Segment()
algo.NumberOfSegments(20)
# define 2D meshing:
# assign triangulation algorithm
algo = tria_mesh.Triangle()
# assign "Max Element Area" hypothesis
2013-02-12 20:37:44 +06:00
algo.MaxElementArea(100)
# compute the mesh
tria_mesh.Compute()