smesh/doc/examples/creating_meshes_ex01.py

34 lines
699 B
Python
Raw Normal View History

2013-02-12 20:37:44 +06:00
# Construction of a Mesh
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 a box
2022-04-11 18:28:01 +05:00
box = geom_builder.MakeBox(0., 0., 0., 100., 200., 300.)
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
tetra = smesh_builder.Mesh(box, "MeshBox")
2013-02-12 20:37:44 +06:00
algo1D = tetra.Segment()
algo1D.NumberOfSegments(7)
algo2D = tetra.Triangle()
algo2D.MaxElementArea(800.)
algo3D = tetra.Tetrahedron()
algo3D.MaxElementVolume(900.)
# compute the mesh
ret = tetra.Compute()
if not ret:
raise Exception("problem when computing the mesh")
print("mesh computed")