# Examples from pyvista.PolyData.strip_offsets
# ============================================

import pyvista as pv
mesh = pv.Rectangle().extrude((0, 0, 1), capping=False)
mesh.strip_offsets

# The offsets and connectivity together describe each strip.
mesh.strip_connectivity[mesh.strip_offsets[0] : mesh.strip_offsets[1]]

# The array is read-only and writing to it raises a `ValueError`.
mesh.strip_offsets.flags['WRITEABLE']

# Assign a new array instead. Here the four strips are merged into two.
mesh.strip_offsets = [0, 8, 16]
mesh.n_strips

# To replace the offsets and connectivity together, assign a
# `pyvista.CellArray` to `strips`.
mesh.strips = pv.CellArray.from_arrays([0, 4], [0, 1, 4, 5])
mesh.n_strips

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
