Salome HOME
0020623: EDF 1209 SMESH: Load script/execfile add the objects in the wrong study
[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 smesh.SetCurrentStudy(salome.myStudy)
32
33 m = smesh.Mesh(cylinder)
34
35 # 2D mesh with BLSURF
36 # -------------------
37
38 algo2d = m.Triangle(smesh.BLSURF)
39
40 algo2d.SetPhysicalMesh(1)
41 algo2d.SetPhySize(5)
42
43 algo2d.SetGeometricMesh(0)
44
45 # 3D mesh with tepal
46 # ------------------
47
48 algo3d = m.Tetrahedron(smesh.GHS3DPRL)
49
50 algo3d.SetMEDName(results)
51 algo3d.SetNbPart(4)
52 algo3d.SetBackground(False)
53 algo3d.SetKeepFiles(False)
54 algo3d.SetToMeshHoles(True)
55
56 # Launch meshers
57 # --------------
58
59 status = m.Compute()
60
61 # Test if ok
62 # ----------
63
64 if os.access(results+".xml", os.F_OK):
65     print "Ok: tepal"
66 else:
67     print "KO: tepal"