pyvista_cad.to_gmsh

On this page

pyvista_cad.to_gmsh#

to_gmsh(mesh, *, model_name='pyvista_cad')[source]#

Install a PyVista mesh as the current gmsh model (in place).

Parameters:
meshpyvista.UnstructuredGrid or pyvista.PolyData

Mesh to register.

model_namestr, default: 'pyvista_cad'

Name of the gmsh model to create.

Raises:
pyvista_cad.OptionalDependencyError

If gmsh is not installed.

Parameters:
Return type:

None

Examples

Register a triangulated PyVista mesh as a gmsh model (requires the [gmsh] extra):

>>> import gmsh
>>> import pyvista as pv
>>> from pyvista_cad import to_gmsh
>>> gmsh.initialize()
>>> gmsh.option.setNumber('General.Terminal', 0)
>>> to_gmsh(pv.Sphere())
>>> gmsh.model.getCurrent()
'pyvista_cad'
>>> gmsh.finalize()