pyvista.PolyData.n_verts

Contents

pyvista.PolyData.n_verts#

property PolyData.n_verts: int[source]#

Return the number of vertex cells.

This is the total number of VERTEX and POLY_VERTEX cells defined in the verts connectivity array.

Note

The number of vertices is separate and distinct from n_points, as it’s possible for PolyData to have points but no verts.

See also

verts
n_lines, n_faces_strict, n_strips

Number of cells in other connectivity arrays.

pyvista.DataSet.n_cells, pyvista.DataSet.n_points

Number of total cells and points in this mesh.

Examples

Create a simple mesh containing just two points and return the number of vertices and cells. By default, when constructing a PolyData with points but no cells, vertices are automatically created, one per point.

>>> import pyvista as pv
>>> mesh = pv.PolyData([[1.0, 0.0, 0.0], [1.0, 1.0, 1.0]])
>>> mesh.n_points, mesh.n_verts, mesh.n_cells
(2, 2, 2)

If any other cells are specified, these vertices are not created.

>>> import pyvista as pv
>>> mesh = pv.PolyData([[1.0, 0.0, 0.0], [1.0, 1.0, 1.0]], lines=[2, 0, 1])
>>> mesh.n_points, mesh.n_verts, mesh.n_cells
(2, 0, 1)