save

ExplicitStructuredGrid.save(filename, binary=True)

Save this VTK object to file.

Parameters
filenamestr

Output file name. VTU and VTK extensions are supported.

binarybool, optional

If True (default), write as binary, else ASCII.

Notes

VTK adds the 'BLOCK_I', 'BLOCK_J' and 'BLOCK_K' cell arrays. These arrays are required to restore the explicit structured grid.

Examples

>>> import pyvista as pv
>>> from pyvista import examples
>>> grid = examples.load_explicit_structured()  
>>> grid.hide_cells(range(80, 120))  
>>> grid.save('grid.vtu')  
>>> grid = pv.ExplicitStructuredGrid('grid.vtu')  
>>> grid.plot(color='w', show_edges=True, show_bounds=True)  
>>> grid.show_cells()  
>>> grid.plot(color='w', show_edges=True, show_bounds=True)