pyvista.PolyData.lines

Contents

pyvista.PolyData.lines#

property PolyData.lines: NumpyArray[int][source]#

Return the lines connectivity array.

Like all padded VTK connectivity arrays, the array is structured as:

[n0, p0_0, p0_1, ..., p0_n, n1, p1_0, p1_1, ..., p1_n, ...]

where n0 is the number of points in line 0, and pX_Y is the Y’th point in line X.

Lines can be a single LINE cell with connectivity to two points, or a POLY_LINE with connectivity to any number of points.

For example, a single line and poly-line with five points might be represented as:

[2, 0, 1, 5, 3, 2, 4, 6, 5]

Where the two separate line cells are [2, 0, 1] and [5, 3, 2, 4, 6, 5].

Lines can also be set by assigning a CellArray.

See also

n_lines
verts, faces, strips

Padded connectivity arrays for other PolyData cell types.

Examples

Return the lines from a spline.

>>> import pyvista as pv
>>> import numpy as np
>>> points = np.random.default_rng().random((3, 3))
>>> spline = pv.Spline(points, 10)
>>> spline.lines
array([10,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9])