How to get access to existing vtkSMRenderViewProxy?

Hello dear developers!

Could you explain me please, how to get access to vtkSMRenderViewProxy in order to invoke points selection from a custom widget?

Best regards


From where ? from a pq class ?


Nice to see you Mathieu,

Yes, I am trying to add a new widget, following the tutorial, it is a subclass of pqPropertyWidget following the prototype:
ClassName(vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject=0)

I am trying to make some points of the dataset selected.
Unfortunately, if I use vtkPythonInteractiveInterpreter, something is triggered and RequestData is called in my filter, which is not desirable due to long time the computation takes.

from paraview.selection import *
SelectIDs(IDs=[0, 1], FieldType='CELL')

I was trying to found the way to do the same in C++, and the closest thing I found was
vtkSMRenderViewProxy::SelectSurfacePoints , but I dont know how to get access to it from the widget

If you could tell me how to make points selected by their IDs with C++ means only, I would be very happy.

I would appreciate your advice very much

Thanks for your reply!

from a pq class, you can access to vtkSMRenderViewProxy using pqRenderView::getRenderViewProxy

Thank you!

Is there a class that allows to select points by ID, not by region?

Mathieu, could you please clarify how to create an instance of pqRenderView from the widget?

Usually you use an already existing view

Is there a class that allows to select points by ID, not by region?

Then you do not want to use this API, but you want to create a SelectionSourceProxy directly.

If I got right what you said, you referred to the vtkSMSelectionHelper
I have tried the following:

  vtkSelection* sel = vtkSelection::New();
  vtkNew<vtkIdTypeArray> ids;

  for (unsigned int i = 0; i < 500; i++)
  vtkNew<vtkSelectionNode> selectionNode;

  vtkSMProxy* selproxy = vtkSMSelectionHelper::NewSelectionSourceFromSelection(given_proxy->GetSession(), sel);

  vtkClientServerStream stream;
  stream << vtkClientServerStream::Invoke << VTKOBJECT(selproxy) << "AddGlobalID" << 1770 << vtkClientServerStream::End;

  vtkSMSession*  session = selproxy->GetSession();

  session->ExecuteStream(selproxy->GetLocation(), stream, false);

It throws no errors, but sadly enough, it does not select any cells

Could you help me understanding what s wrong here please?

Best regards