pyvista.Plotter.enable_cell_picking#
- Plotter.enable_cell_picking(
 - callback=None,
 - through=True,
 - show=True,
 - show_message=True,
 - style='wireframe',
 - line_width=5,
 - color='pink',
 - font_size=18,
 - start=False,
 - show_frustum=False,
 - **kwargs,
 Enable picking of cells with a rectangle selection tool.
Press
"r"to enable rectangle based selection. Press"r"again to turn it off. Selection will be saved toself.picked_cells.All meshes in the scene are available for picking by default. If you would like to only pick a single mesh in the scene, use the
pickable=Falseargument when adding the other meshes to the scene.When multiple meshes are being picked, the picked cells in
self.picked_cellswill be aMultiBlockdataset for each mesh’s selection.Uses last input mesh for input by default.
Warning
Visible cell picking (
through=False) will only work if the mesh is displayed with a'surface'representation style (the default).- Parameters:
 - callback
callable(),optional When input, calls this callable after a selection is made. The picked_cells are input as the first parameter to this callable.
- throughbool, default: 
True When
Truethe picker will select all cells through the mesh(es). WhenFalse, the picker will select only visible cells on the selected surface(s).- showbool, default: 
True Show the selection interactively.
- show_messagebool | 
str, default:True Show the message about how to use the cell picking tool. If this is a string, that will be the message shown.
- style
str, default: “wireframe” Visualization style of the selection. One of the following:
style='surface',style='wireframe', orstyle='points'.- line_width
float, default: 5.0 Thickness of selected mesh edges.
- color
ColorLike, default: “pink” The color of the selected mesh when shown.
- font_size
int, default: 18 Sets the font size of the message.
- startbool, default: 
False Automatically start the cell selection tool.
- show_frustumbool, default: 
False Show the frustum in the scene.
- **kwargs
dict,optional All remaining keyword arguments are used to control how the selection is interactively displayed.
- callback
 
Examples
Add a mesh and a cube to a plot and enable cell picking.
>>> import pyvista as pv >>> mesh = pv.Sphere(center=(1, 0, 0)) >>> cube = pv.Cube() >>> pl = pv.Plotter() >>> _ = pl.add_mesh(mesh) >>> _ = pl.add_mesh(cube) >>> _ = pl.enable_cell_picking()