Obtain information if proxy is visible

Can anyone tell me how I can have my paraview batch script find out if an object is visible or not?

Here is a small example:

from paraview.simple import *

renderView1 = GetActiveViewOrCreate('RenderView')
source = FastUniformGrid()
display = Show(source, renderView1) 

I can Hide the source's display with

Hide(source, renderView1)

but where is the objects display status actually stored?

It is stored in the representation associated with the source. The representation controls how the source is displayed in ParaView, and it includes a Visibility property.

You can use display.Visibility to check whether the representation associated with source is visibile.

I had tried that, but it didn’t quite work reliably.

I think that there is a bug and here is how to reproduce it:

  1. Set up a renderView (RenderView1) with some hidden object in the pipeline

  2. Create a second renderView (RenderView2). By default, all objects are hidden.

  3. Execute the following lines and observe how GetDisplayProperties makes the hidden object visible:

    renderView = FindViewOrCreate('RenderView2', viewtype='RenderView')
    name, source = GetSources().items()[0]
    display = GetDisplayProperties(source, view=renderView)

I believe that there is a bug in the initialization of existing objects when creating a new renderView.
Manually switching the visibility of all objects from hidden to visible and back to hidden again after creating a new renderView is a workaround.

Here is a MWE: state.pvsm (189.6 KB)

Running the following script: run.py (507 Bytes)

#!/usr/bin/env pvpython

from paraview.simple import *



for renderViewName in ['RenderView1', 'RenderView2']:
    renderView = FindViewOrCreate(renderViewName, viewtype='RenderView')
    name, source = GetSources().items()[0]
    display = GetDisplayProperties(source, view=renderView) # this makes the object visible!
    print('{} : display.Visibility={}'.format(renderViewName, display.Visibility))

produces this output:

RenderView1 : display.Visibility=0
RenderView2 : display.Visibility=1