pyvista.PolyData.n_verts#
- property PolyData.n_verts: int[source]#
Return the number of vertex cells.
This is the total number of
VERTEXandPOLY_VERTEXcells defined in thevertsconnectivity array.Note
The number of vertices is separate and distinct from
n_points, as it’s possible forPolyDatato havepointsbut noverts.See also
vertsn_lines,n_faces_strict,n_stripsNumber of cells in other connectivity arrays.
pyvista.DataSet.n_cells,pyvista.DataSet.n_pointsNumber 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)