Salome HOME
Adding support of salome test and make test
[plugins/blsurfplugin.git] / tests / sphere.py
1 # -*- coding: utf-8 -*-
2
3 import sys
4 import salome
5
6 salome.salome_init()
7 theStudy = salome.myStudy
8
9 ###
10 ### GEOM component
11 ###
12
13 import GEOM
14 from salome.geom import geomBuilder
15 geompy = geomBuilder.New(salome.myStudy)
16
17
18 geompy.init_geom(theStudy)
19
20 sphere = geompy.MakeSphereR(10)
21 geompy.addToStudy( sphere, 'sphere' )
22
23 ###
24 ### SMESH component
25 ###
26
27 import SMESH
28 from salome.smesh import smeshBuilder
29 smesh = smeshBuilder.New(salome.myStudy)
30
31
32 Mesh_1 = smesh.Mesh(sphere)
33
34 BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
35 BLSURF_Parameters = BLSURF_1.Parameters()
36 BLSURF_Parameters.SetPhySize( 5 )
37 BLSURF_Parameters.SetGeometricMesh( 1 )
38 BLSURF_Parameters.SetAngleMesh( 8 )
39
40 ok = Mesh_1.Compute()
41
42 if not ok:
43     raise Exception("Error when computing surface mesh")
44
45 Mesh_1.Tetrahedron(algo=smeshBuilder.MG_Tetra)
46
47 ok = Mesh_1.Compute()
48
49 if not ok:
50     raise Exception("Error when computing volume mesh")
51
52 if salome.sg.hasDesktop():
53   salome.sg.updateObjBrowser(True)