pyvista.Actor.copy

Contents

pyvista.Actor.copy#

Actor.copy(deep: bool = True) Actor[source]#

Create a copy of this actor.

Parameters:
deepbool, default: True

Create a shallow or deep copy of the actor. A deep copy will have a new property and mapper, while a shallow copy will use the mapper and property of this actor.

Returns:
pyvista.Actor

Deep or shallow copy of this actor.

Examples

Create an actor of a cube by adding it to a pyvista.Plotter and then copy the actor, change the properties, and add it back to the pyvista.Plotter.

>>> import pyvista as pv
>>> mesh = pv.Cube()
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(mesh, color='b')
>>> new_actor = actor.copy()
>>> new_actor.prop.style = 'wireframe'
>>> new_actor.prop.line_width = 5
>>> new_actor.prop.color = 'r'
>>> new_actor.prop.lighting = False
>>> _ = pl.add_actor(new_actor)
>>> pl.show()
../../../_images/pyvista-Actor-copy-1_00_00.png