pyvista.MultiBlock.set_block_name#

MultiBlock.set_block_name(index: int, name: str | None)[source]#

Set a block’s string name at the specified index.

Parameters:
indexint

Index or the dataset within the multiblock.

namestr, optional

Name to assign to the block at index. If None, no name is assigned to the block.

Examples

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