Plotter.enable_surface_point_picking#
- Plotter.enable_surface_point_picking(
- callback: Callable[..., None] | None = None,
- *,
- show_message: bool | str = True,
- font_size: int = 18,
- color: ColorLike = 'pink',
- show_point: bool = True,
- point_size: float = 10,
- tolerance: float = 0.025,
- pickable_window: bool = False,
- left_clicking: bool = False,
- picker: PickerType | str | int = PickerType.CELL,
- use_picker: bool = False,
- clear_on_no_selection: bool = True,
- **kwargs,
Enable picking of a point on the surface of a mesh.
- Parameters:
- callback
callable(), optional When input, calls this callable after a selection is made. The picked point is input as the first parameter to this callable.
- show_messagebool |
str, default:True Show the message about how to use the mesh picking tool. If this is a string, that will be the message shown.
- font_size
int, default: 18 Sets the font size of the message.
- color
ColorLike, default: “pink” The color of the selected mesh when shown.
- show_pointbool, default:
True Show the selection interactively.
- point_size
int, default: 10 Size of picked points if
show_pointisTrue.- tolerance
float, default: 0.025 Specify tolerance for performing pick operation. Tolerance is specified as fraction of rendering window size. Rendering window size is measured across diagonal.
Warning
This is ignored with the
'hardware'picker.- pickable_windowbool, default:
False When
True, points in the 3D window are pickable.- left_clickingbool, default:
False When
True, meshes can be picked by clicking the left mouse button.Note
If enabled, left-clicking will not display the bounding box around the picked mesh.
- picker
str|PickerType, optional Choice of VTK picker class type:
'hardware': Uses vtkHardwarePicker which is more performant for large geometries.'cell': Uses vtkCellPicker (default).'point': Uses vtkPointPicker which will snap to points on the surface of the mesh.'volume': Uses vtkVolumePicker.
- use_pickerbool, default:
False When
True, the callback will also be passed the picker.- clear_on_no_selectionbool, default:
True Clear the selections when no point is selected.
- **kwargs
dict, optional All remaining keyword arguments are used to control how the picked path is interactively displayed.
- callback
Notes#
Picked point can be accessed from picked_point attribute.
Examples#
Download Python source code | Download Jupyter notebook
Add a cube to a plot and enable cell picking.
>>> import pyvista as pv
>>> cube = pv.Cube()
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(cube)
>>> _ = pl.enable_surface_point_picking()
Used In#
API Examples
Gallery Examples