Plotter.enable_cell_picking(mesh=None, callback=None, through=True, show=True, show_message=True, style='wireframe', line_width=5, color='pink', font_size=18, start=False, **kwargs)#

Enable picking at cells.

Press "r" to enable retangle based selection. Press "r" again to turn it off. Selection will be saved to self.picked_cells. Also press "p" to pick a single cell under the mouse location.

When using through=False, and multiple cells are being picked, the picked cells in ``self.picked_cells will be a MultiBlock dataset for each mesh’s selection.

Uses last input mesh for input by default.


Visible cell picking (through=False) will only work if the mesh is displayed with a 'surface' representation style (the default).

meshpyvista.DataSet, optional

Mesh to select cells from. When through is True, uses last input mesh by default. When through is False, all meshes in the scene are available for picking and this argument is ignored. If you would like to only pick a single mesh in the scene, use the pickable=False argument when adding the other meshes to the scene.

callbackfunction, optional

When input, calls this function after a selection is made. The picked_cells are input as the first parameter to this function.

throughbool, optional

When True (default) the picker will select all cells through the mesh. When False, the picker will select only visible cells on the mesh’s surface.

showbool, optional

Show the selection interactively.

show_messagebool or str, optional

Show the message about how to use the cell picking tool. If this is a string, that will be the message shown.

stylestr, optional

Visualization style of the selection. One of the following: style='surface', style='wireframe', or style='points'. Defaults to 'wireframe'.

line_widthfloat, optional

Thickness of selected mesh edges. Default 5.

colorcolor_like, optional

The color of the selected mesh when shown.

font_sizeint, optional

Sets the font size of the message.

startbool, optional

Automatically start the cell selection tool.

**kwargsdict, optional

All remaining keyword arguments are used to control how the selection is interactively displayed.


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(left_clicking=True)