[Paraview] SurfaceLIC and python interface
Albina, Frank
frank.albina at sauber-motorsport.com
Fri Jul 27 03:00:38 EDT 2012
Hi Seb!
I found out that the following works without having the need to access the C++ API explicitly and this is what I am using now:
from paraview.simple import *
LoadPlugin("libSurfaceLIC.so",ns=globals())
[...]
view = GetRenderView()
source = GetActiveSource()
rep = Show(source,view)
rep.Representation = 'Surface LIC'
rep.SetPropertyWithName('LICIntensity',0.9)
rep.SetPropertyWithName('LICStepSize',0.5)
view.StillRender()
[...]
I discovered that the Surface LIC properties of the rep object are listed when calling print rep.ListProperties(). Their respective values can be output with rep.GetPropertyValue("<Property name>").
Cheers,
Frank.
-----Original Message-----
From: Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
Sent: Donnerstag, 26. Juli 2012 16:32
To: Albina, Frank
Cc: paraview at paraview.org
Subject: Re: [Paraview] SurfaceLIC and python interface
Hi Frank,
normally loading that specific plugin on the server should be enough
as it doesn't have any custom Qt-GUI component in it.
Seb
On Thu, Jul 26, 2012 at 9:57 AM, Albina, Frank
<frank.albina at sauber-motorsport.com> wrote:
> Hi Sebastien!
>
> Thank you very much for the invaluable information. I had found on the internet the following PV bug: http://www.paraview.org/Bug/print_bug_page.php?bug_id=12360, which shows that you have to load the plugin for both server and client when running pvbatch. I had to find the hard way that loading the plugin for the server only does not work. BTW, when loading the plugin for both server and client, I get the following warning messages:
>
> Warning: In /cfdcode/opt/ParaView/SRC/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMProxy.cxx, line 889
> vtkSMPVRepresentationProxy (0x1a51fe0): Proxy SurfaceLICRepresentation already exists. Replacing
>
> Warning: In /cfdcode/opt/ParaView/SRC/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMProxy.cxx, line 889
> vtkSMPVRepresentationProxy (0x1ba4470): Proxy SurfaceLICRepresentation already exists. Replacing
>
> Warning: In /cfdcode/opt/ParaView/SRC/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMProxy.cxx, line 889
> vtkSMPVRepresentationProxy (0x1ceeed0): Proxy SurfaceLICRepresentation already exists. Replacing
>
> [....]
>
> Warning: In /cfdcode/opt/ParaView/SRC/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMProxy.cxx, line 889
> vtkSMPVRepresentationProxy (0x6dce5a0): Proxy SurfaceLICRepresentation already exists. Replacing
>
> Warning: In /cfdcode/opt/ParaView/SRC/paraview-3.14.1/ParaViewCore/ClientServerCore/vtkCompositeRepresentation.cxx, line 99
> vtkPVCompositeRepresentation (0x7184cc0): Replacing existing representation for key: Surface LIC
>
> The same happens with the PV binaries downloaded from KitWare. The platform is x86_64 running under SLED10 Linux.
>
> However, loading the plugin and using the C++ API works just fine.
>
> Thanks again.
>
> Cheers,
>
> Frank.
>
>
>
> -----Original Message-----
> From: Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
> Sent: Donnerstag, 26. Juli 2012 14:04
> To: Albina, Frank
> Cc: paraview at paraview.org
> Subject: Re: [Paraview] SurfaceLIC and python interface
>
> Hi Frank,
>
> I think you need to use the C++ API as the representation was already
> wrapped based on another type of representation that was not providing
> those properties
>
> Here is an example on how to set one of your property.
>
> DataRepresentation1.SMProxy.GetProperty('LICIntensity').SetElement(0,1.0)
>
> Alternatively, when you load you plugin, you can try to provide your
> globals as argument. That might solve the problem too.
>
> LoadPlugin('file', True, globals() )
>
> Seb
>
> On Thu, Jul 26, 2012 at 4:48 AM, Albina, Frank
> <frank.albina at sauber-motorsport.com> wrote:
>> Hi!
>>
>>
>> Forgot to tell that the PV version is 3.14.1.
>>
>>
>> Cheers,
>>
>>
>>
>> Frank.
>>
>>
>>
>> From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org]
>> On Behalf Of Albina, Frank
>> Sent: Donnerstag, 26. Juli 2012 10:26
>> To: paraview at paraview.org
>> Subject: [Paraview] SurfaceLIC and python interface
>>
>>
>>
>> Dear All!
>>
>>
>>
>> I am trying to run the SurfaceLIC representation under pvbatch. From the
>> python trace tool under the GUI, I could find the following output which
>> helps me setting the LIC intensity and LICStepSize:
>>
>>
>>
>> RenderView1 = GetRenderView()
>>
>> DataRepresentation1 = Show()
>>
>> DataRepresentation1.Representation = 'Surface LIC'
>>
>> DataRepresentation1.InterpolateScalarsBeforeMapping = 0
>>
>> DataRepresentation1.LICIntensity = 1.0
>>
>> DataRepresentation1.LICStepSize = 0.25
>>
>>
>>
>> Unfortunately, doing the same within a python script does not work, since I
>> get :
>>
>>
>>
>> AttributeError: Attribute LICIntensity does not exist. This class does not
>> allow addition of new attributes to avoid mistakes due to typos. Use
>> add_attribute() if you really want to add this attribute.
>>
>>
>>
>> The above attributes LICIntensity and LICStepSize are not available from the
>> python shell either, even after having set the representation to 'Surface
>> LIC'. I get the same issue either with the Kitware binaries or those
>> compiled by myself. Even forcing the load of the SurfaceLIC plugin with
>> paraview.servermanager.LoadPlugin("libSurfaceLIC.so") does not solve the
>> issue.
>>
>>
>>
>> I am surely missing one step. Could someone tell me which?
>>
>>
>>
>> Thanks a lot in advance.
>>
>>
>>
>> Cheers,
>>
>>
>>
>> Frank Albina.
>>
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
More information about the ParaView
mailing list