pyvista.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:
pyvista.DataSet
orpyvista.MultiBlock
orNone
Dataset from the given index if it exists.
See also
get
Get a block and return a default value instead of raising an
IndexError
.
Examples
>>> 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 ...