[Paraview] Setter and getter for ParaView Plugin

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Jun 6 08:08:34 EDT 2012


Hi Tuan,

an information_only property is used to retrieve value from the object
by calling some Get Macro.
But information property does not behave the same way a regular property does.
In fact, you need to explicitly call on your proxy
UpdatePropertyInformation() in order to update the local values of
those information properties.
In ParaViewWeb, the method UpdatePropertyInformation() is not exposed
therefore, you will need to write a helper plugin in python.

Here is a sample code that illustrate what you want to achieve:

=== file: helper.py ====

def getProperty( proxy, propertyName ):
    proxy.UpdatePropertyInformation()
    return eval("proxy." + propertyName)  ## You might need to fix
that line, but you get the idea...

==== JavaScript part =====

helper = paraview.getPlugin('helper');
var value = helper.getProperty( myProxy, 'NumberOfSomething' );

Seb

On Tue, Jun 5, 2012 at 5:42 PM, Tuan Ha Tran <tuan-ha.tran at insa-lyon.fr> wrote:
> Thank you very much for your reply, Seb.
> I have been reading lots of exemple in the .xml files before I ask you this
> question :
> For input, we have  command="SetInputArrayToProcess" to know that there is a
> function (if i'm right) which is linked with the input.
> But for the output, there isn't any information like that. So, I wonder if
> the output as information_only="1" is the return value of an vtkGetMacro?
> And if the return value of my function is not an attribute of my class, is
> there any way to see this return value?
>
>
>
> ----- Original Message -----
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> To: Tuan Ha Tran <tuan-ha.tran at insa-lyon.fr>
> Cc: paraview-developers at paraview.org, paraview at paraview.org
> Sent: Tue, 05 Jun 2012 21:26:37 +0200 (CEST)
> Subject: Re: [Paraview] Setter and getter for ParaView Plugin
>
> You just have to use the attribute
>
> information_only="1"
>
> For more details, you can look at the one that are defined inside
> ParaView itself in
> SRC/ParaViewCode/ServerImplementation/Resources/*.xml
>
> Seb
>
> On Tue, Jun 5, 2012 at 3:21 PM, Tuan Ha Tran wrote:
>> Hi everyone,
>>    I want to ask you a question about setter and getter of ParaView
>> Plugin.
>>    As input, we can use the xml file to link them, using
>>, , etc.
>
>>    So, for the outputs, how can we write the xml file?
>>    For exemple, I have a function with "double" as return value. And I
>> want
>> to show this value in ParaView, as well as extract it in Python Shell and
>> JavaScript Terminal (ParaViewWeb).
>>    Thank you very much in advance.
>>
>>
>>
>>
>> _______________________________________________
>> 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