How to retrieve the renderer from a server-side Python's plugin

To render VTK objects in top of default ones, like vtkPolyData, vtkUnstructuredGrid, etc., you need to get both the active view and then the respective renderer to attach a VTK actor to that display or viewport. To do so we often rely on the “simple” module, for instance:

Sample helper class.

class ParaviewHelper:

@staticmethod
def GetActiveOrRenderView():
    from paraview.simple import GetActiveView, GetRenderView
    # Empty once loaded from session file?
    active_view = GetActiveView() 
    if active_view != None:
         return active_view
    # Empty once loaded from session file?
    return GetRenderView()

@staticmethod
def GetActiveRenderer():
    active_view = GPParaviewHelper.GetActiveOrRenderView()
    return active_view.GetRenderer() if active_view != None else None

We need to create a VTK actor to render “names” (strings) in 3-D as texture mappings via well-know mapper approach. However, it is illegal to call the “paraview.simple” module on a server, i.e., distributed plugin, because Paraview crashes. It seems that such API is not available on the server side. That said, I wonder how can I get the renderer from the plugin slot “RequestData” or executive object. Any hints about how this feature can be accomplished?

Thanks in advance,
Horacio Florez.

I think there is no legal way for this (let others correct me) because you don’t have guarantee that calculations (your server-side python’s plugin) and renderings will execute on same machine, right?

But, perhaps you could generate inside of your server-side plugin some meta-data which you can use to generate “names” (strings) on client side?

It is a good point, thanks! However, I have observed that it is also illegal to combine server and client side plugins. I agree; there should be a way for Paraview to do the texture mapping and render captions at 3-D points through a multi-block dataset or annotation of some sort. Perhaps, that is the work-around. Best.