mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 10:08:34 +05:00
39 lines
925 B
Python
39 lines
925 B
Python
# Export of a Mesh
|
|
|
|
import salome
|
|
salome.salome_init()
|
|
import GEOM
|
|
from salome.geom import geomBuilder
|
|
geompy = geomBuilder.New(salome.myStudy)
|
|
|
|
import SMESH, SALOMEDS
|
|
from salome.smesh import smeshBuilder
|
|
smesh = smeshBuilder.New(salome.myStudy)
|
|
|
|
# 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
|
|
tetra.Compute()
|
|
|
|
# export the mesh in a MED file
|
|
tetra.ExportMED("/tmp/meshMED.med", 0)
|
|
|
|
# export a group in a MED file
|
|
face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
|
|
group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
|
|
tetra.ExportMED("/tmp/groupMED.med", meshPart=group)
|