pyvista.DataSet.cell

Contents

pyvista.DataSet.cell#

property DataSet.cell: Iterator[pyvista.Cell][source]#

A generator that provides an easy way to loop over all cells.

To access a single cell, use pyvista.DataSet.get_cell().

Changed in version 0.39.0: Now returns a generator instead of a list. Use get_cell(i) instead of cell[i].

Yields:
pyvista.Cell

Examples

Loop over the cells

>>> import pyvista as pv
>>> # Create a grid with 9 points and 4 cells
>>> mesh = pv.ImageData(dimensions=(3, 3, 1))
>>> for cell in mesh.cell:  
...     cell