# Get proxy by click in paraview web

**URL:** https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310
**Category:** Web Support
**Created:** [November 23, 2023, 6:57am UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310 "2023-11-23T06:57:35Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![fashing](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fashing/32/12357_2.png) [@fashing](https://discourse.paraview.org/u/fashing)
#### Post date: [November 23, 2023, 6:57am UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/1 "2023-11-23T06:57:35Z")

</div>

Hi Paraview,  
I notice that in Paraview, you can right click on a proxy and set properties like visibility, color, representation, etc. I wonder if I can also achieve it in paraview web such as Paraview-lite.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/de0eef7382139e940071c6faa115388a1c35f813.png)

So far, I tried to call `selectCells` method by passing the event’s coordinate, but this method only return a null object. It will be great if I can set a `interactorEvents` which return the proxy id or proxy name.

Thank you!

---

<div class="post-metadata">

### Author: ![fashing](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fashing/32/12357_2.png) [@fashing](https://discourse.paraview.org/u/fashing)
#### Post date: [November 27, 2023, 7:42am UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/2 "2023-11-27T07:42:10Z")

</div>

In the traced script, paraview use `FindSource` with the proxy name without any position information. And I found `selectCells` by default take the active source as input rather than the source you click on.

I wonder if there’s any chance to know which proxy is clicked/selected in python script. Or is there something like `FindSourceByPosition(x, y)` that returns a proxy?

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 27, 2023, 7:39pm UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/3 "2023-11-27T19:39:51Z")

</div>

Not sure about the details, but [that example](https://github.com/Kitware/trame/blob/master/examples/07_paraview/Picking/pv_selection.py) may help the Python side.

---

<div class="post-metadata">

### Author: ![fashing](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fashing/32/12357_2.png) [@fashing](https://discourse.paraview.org/u/fashing)
#### Post date: [November 28, 2023, 2:56am UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/4 "2023-11-28T02:56:54Z")

</div>

Hi @jourdain,  
Thank you for the reply. The example you show uses the same function (`simple.SelectSurfacePoints`) as I did before. I can create the selection (with magenta points), but I cannot infer which source I selected.

What I tried to infer the source by selection is:

```auto
s = selection.SelectSurfacePoints(Rectangle=[x1, y1, x2, y2], Modifier=None)
es = simple.ExtractSelection()
selectedSource = es.Input

```

But I found `selectedSource` is always the same source, since `SelectSurfacePoints` takes the active source by default. When I am curious about how Paraview achieves it in Desktop app, I found the active source is somehow set by source name during the process.

```auto
# create a surface points selection
SelectSurfacePoints(Rectangle=[1365, 353, 1365, 353], Modifier=None)
# find source
contour3 = FindSource('Contour3')
# set active source
SetActiveSource(contour3)
# create a new 'Extract Selection'
extractSelection1 = ExtractSelection(registrationName='ExtractSelection1', Input=contour3)

```

Is there any clue about how Paraview set the correct source active beyond python script?

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [November 28, 2023, 7:06pm UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/5 "2023-11-28T19:06:11Z")

</div>

I will have to investigate more to provide the proper pointers. But unfortunately, I won’t be able to look into it any time soon but my guess is that the selection object does have that information.

---

<div class="post-metadata">

### Author: ![fashing](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fashing/32/12357_2.png) [@fashing](https://discourse.paraview.org/u/fashing)
#### Post date: [November 29, 2023, 2:41am UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/6 "2023-11-29T02:41:05Z")

</div>

No problem. Thank you for your time.

---

<div class="post-metadata">

### Author: ![fashing](https://discourse.paraview.org/user_avatar/discourse.paraview.org/fashing/32/12357_2.png) [@fashing](https://discourse.paraview.org/u/fashing)
#### Post date: [December 8, 2023, 2:40am UTC](https://discourse.paraview.org/t/get-proxy-by-click-in-paraview-web/13310/7 "2023-12-08T02:40:43Z")

</div>

Hi @jourdain,  
I found a tricky way to achieve what I want, which is based on a fact:  
The `Selection` property of `ExtractSelection` filter over a source has value (Class `AppendSelection`) only if the source has selections on it.

Here’s the pseudo code.

```auto
for source in GetSources():
  es = ExtractSelection(source)
  if es.Selection is not None: # exist selection on the source
    ClearSelection(source)
    Delete(es)
    return source

```

I wonder if there’s a property on each source that stores selection information or there’s a global proxy to store all selection information including their corresponding sources. If this approach reminds you anything, I am happy to hear it! Thank you!
