pyvista.MultiBlock.insert#
- MultiBlock.insert(
- index: int,
- dataset: MultiBlock | DataSet,
- name: str | None = None,
Insert data before index.
- Parameters:
- index
int
Index before which to insert data.
- dataset
pyvista.DataSet
orpyvista.MultiBlock
Data to insert.
- name
str
,optional
Name for key to give dataset. A default name is given depending on the block index as
'Block-{i:02}'
.
- index
Examples
Insert a new
pyvista.PolyData
at the start of the multiblock.>>> import pyvista as pv >>> data = { ... "cube": pv.Cube(), ... "sphere": pv.Sphere(center=(2, 2, 0)), ... } >>> blocks = pv.MultiBlock(data) >>> blocks.keys() ['cube', 'sphere'] >>> blocks.insert(0, pv.Plane(), "plane") >>> blocks.keys() ['plane', 'cube', 'sphere']