# How to get access to existing vtkSMRenderViewProxy?

**URL:** https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882
**Category:** Development
**Created:** [February 6, 2024, 12:28pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882 "2024-02-06T12:28:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [February 6, 2024, 12:28pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/1 "2024-02-06T12:28:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 6, 2024, 12:29pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/2 "2024-02-06T12:29:49Z")

</div>

> [@joint](#):
>
> how to get access to vtkSMRenderViewProxy

Hi,

From where ? from a pq class ?

Best,

---

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [February 6, 2024, 12:38pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/3 "2024-02-06T12:38:19Z")

</div>

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.

```auto
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!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 6, 2024, 12:46pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/4 "2024-02-06T12:46:01Z")

</div>

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

[https://kitware.github.io/paraview-docs/latest/cxx/classpqRenderView.html#a9ae103dbd51507809f3d37b00a2a1cf8](https://kitware.github.io/paraview-docs/latest/cxx/classpqRenderView.html#a9ae103dbd51507809f3d37b00a2a1cf8)

---

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [February 6, 2024, 1:00pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/5 "2024-02-06T13:00:48Z")

</div>

Thank you!

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

---

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [February 6, 2024, 1:07pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/6 "2024-02-06T13:07:36Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 6, 2024, 1:15pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/7 "2024-02-06T13:15:31Z")

</div>

> [@joint](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![joint](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@joint](https://discourse.paraview.org/u/joint)
#### Post date: [February 6, 2024, 2:00pm UTC](https://discourse.paraview.org/t/how-to-get-access-to-existing-vtksmrenderviewproxy/13882/8 "2024-02-06T14:00:55Z")

</div>

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

```auto
  vtkSelection* sel = vtkSelection::New();
  vtkNew<vtkIdTypeArray> ids;
  ids->SetNumberOfComponents(1);

  for (unsigned int i = 0; i < 500; i++)
  {
      ids->InsertNextValue(i);
  }
  vtkNew<vtkSelectionNode> selectionNode;
  selectionNode->SetFieldType(vtkSelectionNode::POINT);
  selectionNode->SetContentType(vtkSelectionNode::INDICES);
  selectionNode->SetSelectionList(ids);
  sel->AddNode(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
