# Examples from pyvista.set_new_attribute
# =======================================

# Set a new custom attribute on a mesh.
import pyvista as pv
mesh = pv.PolyData()
pv.set_new_attribute(mesh, 'foo', 42)
mesh.foo

# This is equivalent to using `allow_new_attributes` with `True`.
with pv.allow_new_attributes(True):
    mesh.foo = 42

# Added in version 0.46.

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

