pyvista.MultiBlock.pop

Contents

pyvista.MultiBlock.pop#

MultiBlock.pop(
index: int | str = -1,
) MultiBlock | DataSet | None[source]#

Pop off a block at the specified index.

Parameters:
indexint or str, default: -1

Index or name of the dataset within the multiblock. Defaults to last dataset.

Returns:
pyvista.DataSet or pyvista.MultiBlock

Dataset from the given index that was removed.

Examples

Pop the "cube" multiblock.

>>> import pyvista as pv
>>> data = {
...     'cube': pv.Cube(),
...     'sphere': pv.Sphere(center=(2, 2, 0)),
... }
>>> blocks = pv.MultiBlock(data)
>>> blocks.keys()
['cube', 'sphere']
>>> cube = blocks.pop('cube')
>>> blocks.keys()
['sphere']