Get proxy by click in paraview web

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.

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!

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?

Not sure about the details, but that example may help the Python side.

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:

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.

# create a surface points selection
SelectSurfacePoints(Rectangle=[1365, 353, 1365, 353], Modifier=None)
# find source
contour3 = FindSource('Contour3')
# set active source
# 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?

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.

No problem. Thank you for your time.

1 Like

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.

for source in GetSources():
  es = ExtractSelection(source)
  if es.Selection is not None: # exist selection on the source
    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!

1 Like