[Paraview] loading multiple state-files without hiding and resetting already loaded objects

Grothausmann, Roman Dr. grothausmann.roman at mh-hannover.de
Fri Nov 10 10:28:20 EST 2017


Dear Cory,

On 15/09/17 15:27, Grothausmann, Roman Dr. wrote:
> On 15/09/17 15:14, Cory Quammen wrote:
>> Put a ** in front of reppro[i], e.g.,
>>
>> pvs.SetProperties(repr, **reppro[i])
> Hm, I now get:
> TypeError: SetProperties() argument after ** must be a mapping, not list
> Do I have to store the dict of object properties in another dict instead of a list?

With a dict of dicts
https://github.com/romangrothausmann/ParaView_scripts/commit/3b309cc603433f02afc3e50656bd99f8b7cd0aa8#diff-2804420278bfff084788b82c715c452e
I get:

   File "/net/home/grothama/paraview/scripts/pvsm-multi.py", line 64, in main
     pvs.SetProperties(repr, **reppro[i]);
   File 
"/opt/paraview-5.3.0_GL1/lib/paraview-5.3/site-packages/paraview/simple.py", 
line 568, in SetProperties
     setattr(proxy, param, params[param])
   File 
"/opt/paraview-5.3.0_GL1/lib/paraview-5.3/site-packages/paraview/servermanager.py", 
line 317, in __setattr__
     setter(self, value)
   File 
"/opt/paraview-5.3.0_GL1/lib/paraview-5.3/site-packages/paraview/servermanager.py", 
line 2528, in setProperty
     return self.SetPropertyWithName(propName, value)
   File 
"/opt/paraview-5.3.0_GL1/lib/paraview-5.3/site-packages/paraview/servermanager.py", 
line 375, in SetPropertyWithName
     prop.SetData(arg)
   File 
"/opt/paraview-5.3.0_GL1/lib/paraview-5.3/site-packages/paraview/servermanager.py", 
line 803, in SetData
     raise RuntimeError("This property requires %d values." % 
self.GetNumberOfElements())
RuntimeError: This property requires 3 values.

Any ideas what could still be wrong?

>>> On 07/09/17 23:37, Cory Quammen wrote:
>>>>
>>>> Hi Roman,
>>>>
>>>> It turns out ParaView was not designed for this use case because of
>>>> certain difficulties discussed here:
>>>>
>>>> https://gitlab.kitware.com/paraview/paraview/issues/17442
>>>>
>>>> In your Python script, you could manually cash all the properties of
>>>> the existing representations and restore them after loading the most
>>>> recent state file.
>>>>
>>>> The functions
>>>>
>>>> reprs = GetRepresentations()
>>>> repr = reprs.values()[0]
>>>> props = repr.ListProperties()
>>>> GetProperty(repr, props[0])
>>>>
>>>> would be helpful for this.
>>>>
>>>> Cory
>>>>
>>>>
>>>> On Mon, Sep 4, 2017 at 8:42 AM, Grothausmann, Roman Dr.
>>>> <grothausmann.roman at mh-hannover.de> wrote:
>>>>>
>>>>> Dear mailing list members,
>>>>>
>>>>>
>>>>> It seems that PV (and paraview.simple.LoadState) by default hides already
>>>>> loaded objects (and resets e.g. their coloring) when another state-file
>>>>> is
>>>>> loaded.
>>>>> Is there a way to load multiple state-files after one another without
>>>>> hiding
>>>>> and resetting already existent objects? I.e. a way to concatenate
>>>>> multiple
>>>>> state-files and leave their objects in the state as they got loaded (e.g.
>>>>> colored, hidden/visible)?
>>>>> I do understand that loading a new state-file will reset the camera, but
>>>>> not
>>>>> the rest.
>>>>> Here's my initial attempt to achieve this with pvpython:
>>>>>
>>>>> https://github.com/romangrothausmann/ParaView_scripts/blob/90eb4ca8499070bed941d50b89ebea82fd6a9e23/pvsm-multi.py 
>>>>>
>>>>>
>>>>> Any help or hints are very much appreciated
>>>>> Roman
>>>>>
>>>>> -- 
>>>>> Dr. Roman Grothausmann
>>>>>
>>>>> Tomographie und Digitale Bildverarbeitung
>>>>> Tomography and Digital Image Analysis
>>>>>
>>>>> Medizinische Hochschule Hannover
>>>>> Institut für Funktionelle und Angewandte Anatomie
>>>>> OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland
>>>>>
>>>>> Tel. +49 511 532-2900
>>>>> grothausmann.roman at mh-hannover.de
>>>>> http://www.mh-hannover.de/anatomie.html
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>>> http://paraview.org/Wiki/ParaView
>>>>>
>>>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://public.kitware.com/mailman/listinfo/paraview
>>>>
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> Dr. Roman Grothausmann
>>>
>>> Tomographie und Digitale Bildverarbeitung
>>> Tomography and Digital Image Analysis
>>>
>>> Medizinische Hochschule Hannover
>>> Institut für Funktionelle und Angewandte Anatomie
>>> OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland
>>>
>>> Tel. +49 511 532-2900
>>> grothausmann.roman at mh-hannover.de
>>> http://www.mh-hannover.de/anatomie.html
>>
>>
>>
> 

-- 
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Medizinische Hochschule Hannover
Institut für Funktionelle und Angewandte Anatomie
OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland

Tel. +49 511 532-2900
grothausmann.roman at mh-hannover.de
http://www.mh-hannover.de/anatomie.html


More information about the ParaView mailing list