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

Cory Quammen cory.quammen at kitware.com
Fri Sep 15 09:36:38 EDT 2017


On Fri, Sep 15, 2017 at 9:27 AM, Grothausmann, Roman Dr.
<grothausmann.roman at mh-hannover.de> wrote:
> Dear Cory,
>
> Many thanks for Your quick reply.
> On 15/09/17 15:14, Cory Quammen wrote:
>>
>> Put a ** in front of reppro[i], e.g.,
>>
>> pvs.SetProperties(repr, **reppro[i])
>>
>> That works for me.
>
> 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?

Ah, I didn't read far enough up in your code to see how `reppro` is
defined. ListProperties() just gives you the names of the properties,
not a list or dictionary with the values. You can create a dictionary
of properties and their values with

d = {}
for p in s.ListProperties():
  d[p] = GetProperty(s, p)
reppro.append(d)

- Cory

> Best
> Roman
>
>
>>> 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



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the ParaView mailing list