[Paraview] restoring visibility of representations of multiple, appended PVSMs

Grothausmann, Roman Dr. grothausmann.roman at mh-hannover.de
Thu Mar 22 14:01:24 EDT 2018


Added some very simple PVSMs and a Makefile for testing, as well as the results:
https://github.com/romangrothausmann/ParaView_scripts/tree/test4pvsm-multi01

Only the visibility of the last loaded PVSM is set in the resulting PVSM 
(pvsm-multi_test.pvsm). Swapping the order of the input PVSMs demonstrates this:
https://github.com/romangrothausmann/ParaView_scripts/commit/9cd3db7971

Any idea what could be wrong or missing in the PV-script?

On 20/03/18 17:13, Grothausmann, Roman Dr. wrote:
> Many thanks Cory for your feedback. Not adding empty (None) properties did not 
> help 
> (http://github.com/romangrothausmann/ParaView_scripts/commit/d3af645dd1af2a). 
> Anyway, "ForceUseCache" has a vector of value 0 so it seems to me the actual 
> problem still is that ListProperties() returns properties that are not part of 
> the specific object that is calling ListProperties(). E.g. help(repr) does not 
> list a property called "ForceUseCache" but e.g. "Visibility"
> 
> So I decided to only restore the property "Visibility" for a start:
> http://github.com/romangrothausmann/ParaView_scripts/commit/d1c63f2682e834e
> Even though there is no error on execution any more, the resulting PVSM has only 
> the visibilities set for the last loaded PVSM, i.e. the setting of the 
> "Visibility" of representations loaded from former PVSMs did not have any effect.
> Is there a need to call some kind of Update() to make the property setting have 
> any effect? I tried some rendering 
> (http://github.com/romangrothausmann/ParaView_scripts/commit/294ff85a0cc7a), but 
> that did not help either.
> 
> 
> On 20/03/18 06:12, Cory Quammen wrote:
>> Roman,
>>
>> Looking at your original problem with the error:
>>
>>
>>     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 1296, in SetData
>>       self.SMProperty.AddProxy(value_proxy)
>> TypeError: AddProxy argument 1: method requires a VTK object
>>
>>
>> You are hitting this when attempting to set the DataAxesGrid, which is a 
>> ProxyProperty. In your dictionary, this entry has value 'None', but it looks 
>> like setting a property to value 'None' is not handled correctly in 
>> servermanager.py. As a workaround, I suggest filtering out properties from 
>> your dictionary that have 'None' as a value, i.e., do not add those property 
>> values to your dictionary.
>>
>> HTH,
>> Cory
>>
>> On Mon, Mar 19, 2018 at 12:12 PM, Grothausmann, Roman Dr. 
>> <grothausmann.roman at mh-hannover.de <mailto:grothausmann.roman at mh-hannover.de>> 
>> wrote:
>>
>>     Hi Cory,
>>
>>
>>     Trying to find out what causes the former problems, I inserted a line that
>>     just sets the property that got collected so far:
>>     
>> https://github.com/romangrothausmann/ParaView_scripts/commit/b8058f774535398da3767048219df12d6354e6c5#diff-2804420278bfff084788b82c715c452eR59 
>>
>>     
>> <https://github.com/romangrothausmann/ParaView_scripts/commit/b8058f774535398da3767048219df12d6354e6c5#diff-2804420278bfff084788b82c715c452eR59> 
>>
>>     It already aborts on the first property encountered (ForceUseCache):
>>
>>     <paraview.servermanager.GeometryRepresentation object at 0x7f7b591fc250>
>>     ForceUseCache 0
>>     Traceback (most recent call last):
>>        File "/net/home/paraview/scripts/pvsm-multi.py", line 91, in <module>
>>          main()
>>        File "/net/home/paraview/scripts/pvsm-multi.py", line 59, in main
>>          pvs.SetProperties(repr, **d)
>>        File
>>     "/opt/paraview-5.3.0_GL1/lib/paraview-5.3/site-packages/paraview/simple.py",
>>     line 567, in SetProperties
>>          raise AttributeError("object has no property %s" % param)
>>     AttributeError: object has no property ForceUseCache
>>
>>     Is ListProperties() returning properties that are not part of the specific
>>     object that is calling ListProperties()?
>>
>>     Many thanks for any help or hints,
>>     Roman
>>
>>     On 21/12/17 16:06, Grothausmann, Roman Dr. wrote:
>>
>>         Hi Cory,
>>
>>         On 06/12/17 23:06, Cory Quammen wrote:
>>
>>             Sorry I failed to follow up. Did you find a solution to this problem?
>>
>>
>>         Many thanks for your reply. No, and I'm still stuck. I tried Your
>>         suggestion to remove [0]
>>         
>> (https://github.com/romangrothausmann/ParaView_scripts/commit/e40d1016d698ee363500bb9bf04f29add89b99dd 
>>
>>         
>> <https://github.com/romangrothausmann/ParaView_scripts/commit/e40d1016d698ee363500bb9bf04f29add89b99dd>), 
>>
>>         which changed the reported error from:
>>
>>             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.
>>
>>         to:
>>
>>             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 1296, in SetData
>>               self.SMProperty.AddProxy(value_proxy)
>>         TypeError: AddProxy argument 1: method requires a VTK object
>>
>>         Any ideas on this?
>>         Would You say it is a general problem in the py-code or could it be
>>         caused by the content of the PVSMs I'm trying to combine?
>>
>>         Many thanks for looking into this.
>>         Roman
>>
>>
>>             This line in your script looks funny to me:
>>
>>             d[props] = pvs.GetProperty(repr, props[0])
>>
>>             Shouldn't props[0] just be props?
>>
>>             Thanks,
>>             Cory
>>
>>             On Fri, Nov 10, 2017 at 10:28 AM, Grothausmann, Roman Dr.
>>             <grothausmann.roman at mh-hannover.de
>>             <mailto:grothausmann.roman at mh-hannover.de>> wrote:
>>
>>                 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 
>>
>>                 
>> <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
>>                                 
>> <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
>>                                 <mailto: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 
>>
>>                                     
>> <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
>>                                     <tel:%2B49%20511%20532-2900>
>>                                     grothausmann.roman at mh-hannover.de
>>                                     <mailto:grothausmann.roman at mh-hannover.de>
>>                                     http://www.mh-hannover.de/anatomie.html
>>                                     <http://www.mh-hannover.de/anatomie.html>
>>                                     
>> _______________________________________________
>>                                     Powered by www.kitware.com
>>                                     <http://www.kitware.com>
>>
>>                                     Visit other Kitware open-source projects at
>>                                     
>> http://www.kitware.com/opensource/opensource.html
>>                                     
>> <http://www.kitware.com/opensource/opensource.html>
>>
>>                                     Please keep messages on-topic and check the
>>                                     ParaView Wiki at:
>>                                     http://paraview.org/Wiki/ParaView
>>                                     <http://paraview.org/Wiki/ParaView>
>>
>>                                     Search the list archives at:
>>                                     http://markmail.org/search/?q=ParaView
>>                                     <http://markmail.org/search/?q=ParaView>
>>
>>                                     Follow this link to subscribe/unsubscribe:
>>                                     
>> http://public.kitware.com/mailman/listinfo/paraview
>>                                     
>> <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 <tel:%2B49%20511%20532-2900>
>>                             grothausmann.roman at mh-hannover.de
>>                             <mailto:grothausmann.roman at mh-hannover.de>
>>                             http://www.mh-hannover.de/anatomie.html
>>                             <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 <tel:%2B49%20511%20532-2900>
>>                 grothausmann.roman at mh-hannover.de
>>                 <mailto:grothausmann.roman at mh-hannover.de>
>>                 http://www.mh-hannover.de/anatomie.html
>>                 <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 <tel:%2B49%20511%20532-2900>
>>     grothausmann.roman at mh-hannover.de <mailto:grothausmann.roman at mh-hannover.de>
>>     http://www.mh-hannover.de/anatomie.html
>>     <http://www.mh-hannover.de/anatomie.html>
>>
>>
>>
>>
>> -- 
>> Cory Quammen
>> Staff R&D Engineer
>> Kitware, Inc.
> 

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