1 # -*- coding: iso-8859-1 -*-
6 theStudy = salome.myStudy
9 from salome.geom import geomBuilder
10 geompy = geomBuilder.New(theStudy)
12 from salome.smesh import smeshBuilder
13 smesh = smeshBuilder.New(theStudy)
15 from salome.GMSHPlugin import GMSHPluginBuilder
18 Box = geompy.MakeBoxDXDYDZ(10, 10, 10)
19 geompy.addToStudy( Box, 'Box' )
21 # 1. Create a 2D mesh on the box with GMSH_2D algorithm
22 Mesh_2D = smesh.Mesh(Box, "Box : 2D mesh by GMSH_2D")
23 # create a Gmsh 2D algorithm for solids
24 Algo_2D = Mesh_2D.Triangle(algo=smeshBuilder.GMSH_2D)
26 Param_2D = Algo_2D.Parameters()
28 Param_2D.Set2DAlgo( 0 )
30 Param_2D.SetMinSize( 0 )
32 Param_2D.SetMaxSize( 2 )
34 # 2. Create a 3D mesh on the box with GMSH_3D algorithm
35 Mesh_3D = smesh.Mesh(Box, "Box : 3D mesh by GMSH_3D")
36 # create a Gmsh 3D algorithm for solids
37 Algo_3D = Mesh_3D.Tetrahedron(algo=smeshBuilder.GMSH)
39 Param_3D = Algo_3D.Parameters()
41 Param_3D.Set2DAlgo( 0 )
43 Param_3D.Set3DAlgo( 0 )
44 # define min element size
45 Param_3D.SetMinSize( 0 )
46 # define max element size
47 Param_3D.SetMaxSize( 2 )
53 if salome.sg.hasDesktop():
54 salome.sg.updateObjBrowser(1)