Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_SWIG / ex30_tepal.py
1 #  -*- coding: iso-8859-1 -*-
2 # CEA/LGLS 2008, Christian Van Wambeke (CEA/LGLS), Francis KLOSS (OCC)
3 # ====================================================================
4
5 import os
6
7 import geompy
8 import smesh
9
10 # Parameters
11 # ----------
12
13 results = "/tmp/ZZ"
14
15 radius =  50
16 height = 200
17
18 # Build a cylinder
19 # ----------------
20
21 base = geompy.MakeVertex(0, 0, 0)
22 direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
23
24 cylinder = geompy.MakeCylinder(base, direction, radius, height)
25
26 geompy.addToStudy(cylinder, "Cylinder")
27
28 # Define a mesh on a geometry
29 # ---------------------------
30
31 m = smesh.Mesh(cylinder)
32
33 # 2D mesh with BLSURF
34 # -------------------
35
36 algo2d = m.Triangle(smesh.BLSURF)
37
38 algo2d.SetPhysicalMesh(1)
39 algo2d.SetPhySize(5)
40
41 algo2d.SetGeometricMesh(0)
42
43 # 3D mesh with tepal
44 # ------------------
45
46 algo3d = m.Tetrahedron(smesh.GHS3DPRL)
47
48 algo3d.SetMEDName(results)
49 algo3d.SetNbPart(4)
50 algo3d.SetBackground(False)
51 algo3d.SetKeepFiles(False)
52 algo3d.SetToMeshHoles(True)
53
54 # Launch meshers
55 # --------------
56
57 status = m.Compute()
58
59 # Test if ok
60 # ----------
61
62 if os.access(results+".xml", os.F_OK):
63     print "Ok: tepal"
64 else:
65     print "KO: tepal"