# Examples from pyvista.PolyData.line_offsets
# ===========================================

import pyvista as pv
points = [[0.0, 0.0, 0.0], [1.0, 1.0, 0.0], [2.0, 0.0, 0.0]]
mesh = pv.Spline(points, 10)
mesh.line_offsets

# The offsets and connectivity together describe each line.
mesh.line_connectivity[mesh.line_offsets[0] : mesh.line_offsets[1]]

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

# Assign a new array instead. Here the single polyline is split into two.
mesh.line_offsets = [0, 5, 10]
mesh.n_lines

# To replace the offsets and connectivity together, assign a
# `pyvista.CellArray` to `lines`.
mesh.lines = pv.CellArray.from_arrays([0, 2], [0, 9])
mesh.n_lines

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