pyvista.DataSet.copy_from

pyvista.DataSet.copy_from#

DataSet.copy_from(
mesh: vtkDataSet,
deep: bool = True,
) None[source]#

Overwrite this dataset inplace with the new dataset’s geometries and data.

Parameters:
meshvtk.vtkDataSet

The overwriting mesh.

deepbool, default: True

Whether to perform a deep or shallow copy.

Examples

Create two meshes and overwrite mesh_a with mesh_b. Show that mesh_a is equal to mesh_b.

>>> import pyvista as pv
>>> mesh_a = pv.Sphere()
>>> mesh_b = pv.Cube()
>>> mesh_a.copy_from(mesh_b)
>>> mesh_a == mesh_b
True