get#

MultiBlock.get(index: str, default: Optional[Union[MultiBlock, DataSet]] = None) Optional[Union[MultiBlock, DataSet]][source]#

Get a block by its name.

If the name is non-unique then returns the first occurrence. Returns default if name isn’t in the dataset.

Parameters:
indexstr

Index or name of the dataset within the multiblock.

defaultpyvista.DataSet or pyvista.MultiBlock, optional

Default to return if index is not in the multiblock.

Returns:
pyvista.DataSet or pyvista.MultiBlock or None

Dataset from the given index if it exists.

Examples

>>> import pyvista as pv
>>> from pyvista import examples
>>> data = {"poly": pv.PolyData(), "uni": pv.UniformGrid()}
>>> blocks = pv.MultiBlock(data)
>>> blocks.get("poly")
PolyData ...
>>> blocks.get("cone")