pyvista.MultiBlock.get#
- MultiBlock.get(
- index: int | str,
- default: MultiBlock | DataSet | None = None,
Get a block by its index or name.
If the name is non-unique then returns the first occurrence. Returns
defaultif name isn’t in the dataset.- Parameters:
- index
int|str Index or name of the dataset within the multiblock.
- default
pyvista.DataSetorpyvista.MultiBlock,optional Default to return if index is not in the multiblock.
- index
- Returns:
pyvista.DataSetorpyvista.MultiBlockorNoneDataset from the given index if it exists.
See also
get_blockGet a block and raise an
IndexErrorif index is not found.
Examples
>>> import pyvista as pv >>> from pyvista import examples >>> data = {'poly': pv.PolyData(), 'img': pv.ImageData()} >>> blocks = pv.MultiBlock(data) >>> blocks.get('poly') PolyData ... >>> blocks.get('cone')