How about interactor using

vtk.vtkInteractorStyleRubberBandPick
This interactor style allows the user to draw a rectangle in the render window by hitting ‘r’ .How can I do event(draw a rectangle) withou hitting ‘r’?

Hi,
You can call the method StartSelect() on your vtkInteractorStyleRubberBandPick and it will programmatically switch the interactor in selection mode.
Hope this helps,
J.

1 Like

Thanks. It works well.

Excuseme. But how to end with this selection mode?

Looks like the implementation is not finished to address this specific case.
An alternative is to simulate the press of the ‘r’ key on your vtkRenderWindowInteractor instance like this:

  iren->SetKeyCode('r');
  iren->InvokeEvent(vtkCommand::CharEvent, nullptr); 
1 Like

Thanks.I use pyautogui to imitate pressing ‘r’ to stop selection mode .Maybe it’s not good enough.