get_reader

get_reader(filename)

Get a reader for fine-grained control of reading data files.

Supported file types and Readers:

File Extension

Class

.case

pyvista.EnSightReader

.facet

pyvista.FacetReader

.foam

pyvista.OpenFOAMReader

.g

pyvista.BYUReader

.obj

pyvista.OBJReader

.p3d

pyvista.Plot3DMetaReader

.ply

pyvista.PLYReader

.pvd

pyvista.PVDReader

.pvti

pyvista.XMLPImageDataReader

.pvtk

pyvista.VTKPDataSetReader

.pvtr

pyvista.XMLPRectilinearGridReader

.pvtu

pyvista.XMLPUnstructuredGridReader

.stl

pyvista.STLReader

.tri

pyvista.BinaryMarchingCubesReader

.vti

pyvista.XMLImageDataReader

.vtk

pyvista.VTKDataSetReader

.vtm

pyvista.XMLMultiBlockDataReader

.vtmb

pyvista.XMLMultiBlockDataReader

.vtp

pyvista.XMLPolyDataReader

.vtr

pyvista.XMLRectilinearGridReader

.vts

pyvista.XMLStructuredGridReader

.vtu

pyvista.XMLUnstructuredGridReader

Parameters
filenamestr

The string path to the file to read.

Returns
pyvista.BaseReader

A subclass of pyvista.BaseReader is returned based on file type.

Examples

>>> import pyvista
>>> from pyvista import examples
>>> filename = examples.download_human(load=False)
>>> filename.split("/")[-1]  # omit the path
'Human.vtp'
>>> reader = pyvista.get_reader(filename)
>>> reader  
XMLPolyDataReader('.../Human.vtp')
>>> mesh = reader.read()
>>> mesh 
PolyData ...
>>> mesh.plot(color='tan')
../../../_images/pyvista-get_reader-1_00_00.png