1 # -*- coding: iso-8859-1 -*-
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New()
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New()
13 from salome.GMSHPlugin import GMSHPluginBuilder
16 Box = geompy.MakeBoxDXDYDZ(10, 10, 10)
17 geompy.addToStudy( Box, 'Box' )
19 # 1. Create a 2D mesh on the box with GMSH_2D algorithm
20 Mesh_2D = smesh.Mesh(Box, "Box : 2D mesh by GMSH_2D")
21 # create a Gmsh 2D algorithm for solids
22 Algo_2D = Mesh_2D.Triangle(algo=smeshBuilder.GMSH_2D)
24 Param_2D = Algo_2D.Parameters()
26 Param_2D.Set2DAlgo( 0 )
28 Param_2D.SetMinSize( 0 )
30 Param_2D.SetMaxSize( 2 )
32 # 2. Create a 3D mesh on the box with GMSH_3D algorithm
33 Mesh_3D = smesh.Mesh(Box, "Box : 3D mesh by GMSH_3D")
34 # create a Gmsh 3D algorithm for solids
35 Algo_3D = Mesh_3D.Tetrahedron(algo=smeshBuilder.GMSH)
37 Param_3D = Algo_3D.Parameters()
39 Param_3D.Set2DAlgo( 0 )
41 Param_3D.Set3DAlgo( 0 )
42 # define min element size
43 Param_3D.SetMinSize( 0 )
44 # define max element size
45 Param_3D.SetMaxSize( 2 )
51 if salome.sg.hasDesktop():
52 salome.sg.updateObjBrowser()