Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / doc / salome / examples / creating_meshes_ex05.py
1 # Export of a Mesh
2
3 import geompy
4 import smesh
5
6 # create a box
7 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
8 idbox = geompy.addToStudy(box, "box")
9
10 # create a mesh
11 tetra = smesh.Mesh(box, "MeshBox")
12
13 algo1D = tetra.Segment()
14 algo1D.NumberOfSegments(7)
15
16 algo2D = tetra.Triangle()
17 algo2D.MaxElementArea(800.)
18
19 algo3D = tetra.Tetrahedron()
20 algo3D.MaxElementVolume(900.)
21
22 # compute the mesh
23 tetra.Compute()
24
25 # export the mesh in a MED file
26 tetra.ExportMED("/tmp/meshMED.med", 0)
27
28 # export a group in a MED file
29 face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0] # a box side
30 group = tetra.GroupOnGeom( face, "face group" ) # group of 2D elements on the <face>
31 tetra.ExportMED("/tmp/groupMED.med", meshPart=group)