[Paraview] loading multiple state-files without hiding and resetting already loaded objects
Cory Quammen
cory.quammen at kitware.com
Fri Sep 15 09:14:51 EDT 2017
On Fri, Sep 15, 2017 at 8:09 AM, Grothausmann, Roman Dr.
<grothausmann.roman at mh-hannover.de> wrote:
> Dear Cory,
>
>
> Many thanks for your reply pointing out the known limitations and
> suggestions for restoring with python. I tried to give that a try:
> https://github.com/romangrothausmann/ParaView_scripts/blob/146aa352d1a3ada203bcf91d17e11c169bc99583/pvsm-multi.py#L44-L61
>
> but am stuck at the python error:
> TypeError: SetProperties() takes at most 1 argument (2 given)
> while the docs suggest to specify 2 args:
> https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.html?highlight=getproperty#paraview.simple.SetProperties
>
> What am I missing here? Do I have to set each property by itself (i.e. from
> GetProperty) or can I just set the whole list of properties from
> ListProperties() in one go?
> Is the approach for restoring to go through all objects from the last
> LoadState the right one?
Put a ** in front of reppro[i], e.g.,
pvs.SetProperties(repr, **reppro[i])
That works for me. The ** unpacks the dictionary into a variable
keyword parameter. See [1] for more info.
> Many thanks for looking into this.
> Roman
No problem.
Thanks,
Cory
[1] https://softwareengineering.stackexchange.com/questions/131403/what-is-the-name-of-in-python/131415
>
> 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
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
More information about the ParaView
mailing list