Composite Datasets

The pyvista.MultiBlock class is a composite class to hold many data sets which can be iterated over.

You can think of MultiBlock like lists or dictionaries as we can iterate over this data structure by index and we can also access blocks by their string name.

Create empty composite dataset

>>> import pyvista
>>> blocks = pyvista.MultiBlock()

Add a dataset to the collection

>>> blocks.append(pyvista.Sphere())

Or add a named block

>>> blocks["cube"] = pyvista.Cube(center=(0, 0, -1))

Plotting the MultiBlock plots all the meshes contained by it.

>>> blocks.plot(smooth_shading=True)
../../_images/composite-1_00_00.png

Examples using this class:

MultiBlock API Reference

The pyvista.MultiBlock class holds attributes that are common to all spatially referenced datasets in PyVista. This base class is analogous to VTK’s vtk.vtkMultiBlockDataSet class.

pyvista.MultiBlock(*args, **kwargs)

A composite class to hold many data sets which can be iterated over.