Highlight mesh in Paraview

Is there way to highlight specific geometry (as a whole mesh, particular face, edge) via python API in Paraview? So far I’ve noticed functionality to select cells, points and blocks, but that seems related to data processing. Whereas my need is rather to let user know that some geometry object is selected.

Thanks.

Hi @CapLek ,

SelectCells() should do the trick.

Best,

1 Like

Hi Mathieu,

Thanks for the reply. Are there any other options? What about separate face/surface/edge highlight?

You can SelectCells/Points/Blocks, like in ParaView. There is no concept of face/edges in ParaView, unless your data is already decomposed in these different element as cells.

Thanks for explanation. Another question to ask is how to select cells of the clicked object through the API?

Here’s what I’m doing.

  1. Getting the active view.
  2. Calling SelectSurfaceCells with the coordinates of click to get the clicked proxy.
  3. When I’m calling simple.SelectCells with proxy from step 2 as an argument I`m getting an error

Traceback (most recent call last):
File “”, line 22, in
File “C:\Program Files\ParaView 5.10.0-Windows-Python3.9-msvc2017-AMD64\bin\Lib\site-packages\paraview\simple.py”, line 2347, in SelectCells
return _select(“CELL”, query, proxy)
File “C:\Program Files\ParaView 5.10.0-Windows-Python3.9-msvc2017-AMD64\bin\Lib\site-packages\paraview\simple.py”, line 2339, in _select
proxy.SMProxy.SetSelectionInput(proxy.Port, selSource.SMProxy, 0)
AttributeError: ‘paraview.modules.vtkRemotingServerManager.vtkSMSou’ object has no attribute ‘SMProxy’

It looks like I need to convert obtained proxy object to some other type, but I don`t know which one. Could you please point to the right type or a useful documentation section?

You need to provide a Selection query to select, the doc is here:

https://kitware.github.io/paraview-docs/latest/python/paraview.simple.html?highlight=selectcells#paraview.simple.SelectCells

Example usage here:

But what if I want to select all cells of the source I’ve clicked on (at the same time there can be some number of other sources on the scene)? Why do I need to provide the query if I want all cells to be selected?

The question was how can I find out which source I’ve clicked on?

I’m not sure to follow, can you explain what you are trying to do and the “ideal” steps you want to take ?

I want to highlight geometry which I’ve just clicked on using paraviewweb in server-side rendering mode to let user know that this geometry has been selected.

My current approach was to get the proxy object which was clicked by calling
activeView.SelectSurfaceCells([x,y,x,y], representations, sources, 0) as it’s done internally in view.Pick() method.
Then I’d like to use target proxy to select all its cells by using
simple.SelectCells(proxy=sources.GetItemAsObject(0))

Is there any other way to highlight clicked geometry?

Sounds like a web question then.