2013-02-12 20:37:44 +06:00
|
|
|
# Construction of a Mesh
|
|
|
|
|
2013-04-04 13:08:19 +06:00
|
|
|
import salome
|
|
|
|
salome.salome_init()
|
|
|
|
import GEOM
|
|
|
|
from salome.geom import geomBuilder
|
2017-06-13 15:01:10 +05:00
|
|
|
geompy = geomBuilder.New()
|
2013-04-04 13:08:19 +06:00
|
|
|
|
|
|
|
import SMESH, SALOMEDS
|
|
|
|
from salome.smesh import smeshBuilder
|
2017-06-13 15:01:10 +05:00
|
|
|
smesh = smeshBuilder.New()
|
2013-02-12 20:37:44 +06:00
|
|
|
|
|
|
|
# create a box
|
|
|
|
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
|
|
|
|
idbox = geompy.addToStudy(box, "box")
|
|
|
|
|
|
|
|
# create a mesh
|
|
|
|
tetra = smesh.Mesh(box, "MeshBox")
|
|
|
|
|
|
|
|
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 ret == 0:
|
2017-03-20 17:27:30 +05:00
|
|
|
print("problem when computing the mesh")
|
2013-02-12 20:37:44 +06:00
|
|
|
else:
|
2017-03-20 17:27:30 +05:00
|
|
|
print("mesh computed")
|
2013-02-12 20:37:44 +06:00
|
|
|
pass
|