[Paraview] Need help with reload macro

Major A andras.g.major at gmail.com
Fri Aug 26 18:23:55 EDT 2016


Hello there,

I'm relatively new to Paraview, and I'd love to have an easy way of 
reloading the data and updating the display.  From the list archives, I 
understand there is no ready-made solution for this at the moment.

So I got the idea to use the sequence "Reset session" -> "Load State" 
from the menu, which works like a charm but is a hassle nonetheless.

Next, I tried using this python code as a macro:

   from paraview.simple import *
   from tempfile import *

   t = NamedTemporaryFile(suffix=".pvsm", delete=False)
   f = t.name

   SaveState(f)

   s = GetSources()
   for key,val in s.items():
       Delete(val)

   LoadState(f)

This works, sort of, but deleting the sources isn't quite the same as 
resetting the session, for which I haven't been able to find a python 
equivalent.  What it does, however, is to create a new layout each time 
I run the macro, and display a warning "This code may not work in 
multi-clients mode" as well.  It also appears to tie up a lot of memory 
after a few uses, which isn't really that funny.

I also tried adding equivalent lines to delete the views and the 
layouts, but behaviour was the same whatever I did.

So, what do I need to do differently?  What's the closest I could get in 
python to the menu item "Reset session"?

Thanks!


More information about the ParaView mailing list