PolyData.strip_connectivity#
- property PolyData.strip_connectivity: NumpyArray[int][source]#
Return the connectivity array of the triangle strips.
The connectivity array stores the point ids of every strip, one strip after another and without any padding. Use
strip_offsetsto determine where each strip begins and ends.Vertices, lines, faces, and strips are held in four separate cell arrays, each with its own offsets and connectivity.
Added in version 0.49.
- Returns:
numpy.ndarrayPoint ids that define the strips.
Notes#
The returned array is read-only and cannot be modified in place. To change the
connectivity, assign a new array to this property. The input is copied, so the
mesh never aliases an array that may be modified later. To replace the offsets
and connectivity together, assign a pyvista.CellArray to strips.
Where that copy is too expensive, assign a pyvista.CellArray built with
from_arrays() and deep=False to strips, and
keep a reference to the connectivity array. The mesh then wraps that array, so
writing to it changes the strips without any copy. Nothing validates the point
ids written this way.
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> mesh = pv.Rectangle().extrude((0, 0, 1), capping=False)
>>> mesh.strip_connectivity[:4]
array([0, 1, 4, 5]...)
The array is read-only and writing to it raises a ValueError.
>>> mesh.strip_connectivity.flags['WRITEABLE']
False
Assign a new array instead. Here the first strip is wound the other way.
>>> connectivity = mesh.strip_connectivity.copy()
>>> connectivity[:4] = [1, 0, 5, 4]
>>> mesh.strip_connectivity = connectivity
>>> mesh.strip_connectivity[:4]
array([1, 0, 5, 4]...)
For a mesh large enough that the copy matters, keep the connectivity array and edit it in place.
>>> import numpy as np
>>> connectivity = np.array([0, 1, 4, 5], dtype=pv.ID_TYPE)
>>> mesh.strips = pv.CellArray.from_arrays([0, 4], connectivity, deep=False)
>>> connectivity[:] = [1, 0, 5, 4]
>>> mesh.strip_connectivity
array([1, 0, 5, 4]...)
See Also#
strip_offsetsIndex into this array at which each strip begins.
n_stripsNumber of strips.
stripsStrips in the legacy padded format.
vert_connectivity,line_connectivity,face_connectivityConnectivity arrays of the other
PolyDatacell types.
Used In#
Docstring Examples
PolyData.strip_offsets(1 use)