MultiBlock.get_block#
- MultiBlock.get_block( ) MultiBlock | DataSet | None[source]#
Get a block by its index or name.
If the name is non-unique then returns the first occurrence. This method is similar to using
[]for indexing except this method also supports indexing nested blocks.Added in version 0.45.
- Parameters:
- Returns:
- output
pyvista.DataSet|pyvista.MultiBlock|None Dataset from the given index if it exists.
- output
See also
getGet a block and return a default value instead of raising an
IndexError.
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> blocks = pv.MultiBlock([pv.PolyData(), pv.ImageData()])
>>> nested = pv.MultiBlock([blocks])
>>> nested.get_block(0)
MultiBlock ...
>>> nested.get_block((0, 1))
ImageData ...