Salome HOME
39b260723bced46f89e4d9c4ec251764fdab07ce
[modules/smesh.git] / doc / salome / examples / radial_prism_3d_algo.py
1 # Usage of Radial Prism 3D meshing algorithm
2
3 import salome
4 salome.salome_init()
5 from salome.geom import geomBuilder
6 geompy = geomBuilder.New(salome.myStudy)
7 import SMESH
8 from salome.smesh import smeshBuilder
9 smesh =  smeshBuilder.New(salome.myStudy)
10
11 # Create geometry: hollow sphere
12
13 sphere_1 = geompy.MakeSphereR( 100 )
14 sphere_2 = geompy.MakeSphereR( 50 )
15
16 hollow_sphere = geompy.MakeCut( sphere_1, sphere_2, theName="hollow sphere")
17
18 faces = geompy.ExtractShapes( hollow_sphere, geompy.ShapeType["FACE"] )
19
20
21 # Create mesh 
22
23 mesh = smesh.Mesh( hollow_sphere, "Mesh of hollow sphere" )
24
25 # assign Global Radial Prism algorithm
26 prism_algo = mesh.Prism()
27
28 # define projection between the inner and outer spheres
29 mesh.Triangle( smeshBuilder.NETGEN_1D2D, faces[0] )    # NETGEN on faces[0]
30 mesh.Projection1D2D( faces[1] ).SourceFace( faces[0] ) # projection faces[0] -> faces[1]
31
32 # define distribution of layers using Number of Segments hypothesis in logarithmic mode
33 prism_algo.NumberOfSegments( 4, 5. )
34
35 # compute the mesh
36 mesh.Compute()