Python package GMSHPluginBuilder defines several classes, destined for creation of the 2D and 3D meshes.
Documentation for GMSHPlugin package is available in linear form grouped by classes, declared in the GMSHPluginBuilder.py file.
Below you can see an example of usage of the GMSHPluginBuilder package for mesh generation:
Example of 2d and 3d mesh generation with GMSH:
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
from salome.GMSHPlugin import GMSHPluginBuilder
Box = geompy.MakeBoxDXDYDZ(10, 10, 10)
geompy.addToStudy( Box, 'Box' )
Mesh_2D = smesh.Mesh(Box, "Box : 2D mesh by GMSH_2D")
Algo_2D = Mesh_2D.Triangle(algo=smeshBuilder.GMSH_2D)
Param_2D = Algo_2D.Parameters()
Param_2D.Set2DAlgo( 0 )
Param_2D.SetMinSize( 0 )
Param_2D.SetMaxSize( 2 )
Mesh_3D = smesh.Mesh(Box, "Box : 3D mesh by GMSH_3D")
Algo_3D = Mesh_3D.Tetrahedron(algo=smeshBuilder.GMSH)
Param_3D = Algo_3D.Parameters()
Param_3D.Set2DAlgo( 0 )
Param_3D.SetIs2d( 0 )
Param_3D.Set3DAlgo( 0 )
Param_3D.SetMinSize( 0 )
Param_3D.SetMaxSize( 2 )
Mesh_2D.Compute()
Mesh_3D.Compute()
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()
Download this script