Skip to content

Commit

Permalink
Add export section to getting started (pyvista#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
banesullivan authored Jan 30, 2020
1 parent a1b1257 commit 29356e0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/getting-started/simple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,34 @@ Be sure to check out all the available plotters for your use case:

* :class:`pyvista.Plotter`: The standard plotter that pauses the code until closed
* :class:`pyvista.BackgroundPlotter`: Creates a rendering window that is interactive and does not pause the code execution



Exporting
~~~~~~~~~

Any PyVista mesh object can be saved to a VTK file format using the ``.save()``
method bound directly on those objects. For example, the mesh used above could
be saved like:

.. code-block:: python
mesh.save("mesh.vtk")
Or since that mesh is :class:`pyvista.PolyData`, we could use the ``.vtp``,
``.stl``, or ``.ply`` formats as well.
For more details on which formats are supported in the ``.save()`` method,
please refer to the docs for that method on each mesh type.

Also note that we can export any PyVista mesh to any file format supported by
`meshio <https://github.com/nschloe/meshio>`_. Meshio supports many formats
including: Abaqus, ANSYS msh, AVS-UCD, CGNS, DOLFIN XML, Exodus, FLAC3D, H5M,
Kratos/MDPA, Medit, MED/Salome, Gmsh (versions 2 and 4), OBJ, OFF, PERMAS,
PLY, STL, TetGen .node/.ele, SVG (2D only, output only), UGRID, WKT (TIN),
XDMF, and more!

To save a PyVista mesh using ``meshio``, use :func:`pyvista.save_meshio`:

.. code-block:: python
pv.save_meshio("mesh.obj", mesh)

0 comments on commit 29356e0

Please sign in to comment.