[Paraview] JavaScript API - ParaViewWeb - how to call function

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue May 15 07:56:09 EDT 2012


Hi Tuan,

The 'missing' documentation that you are looking for is inside the
appendix of http://paraview.org/Wiki/ParaView/Users_Guide/Table_Of_Contents
under "List of ...".
Those API's are defined by some XML files that describe all the
ParaView proxies. ParaView does not use VTK class directly but instead
use Proxy to abstract the location and distribution of the real VTK
class instance.

Regarding the plugin part, I was talking about ParaViewWeb plugin
(Python), not ParaView plugin (XML/C++) but in any case you can use
both if you need to.

Moreover, depending on what you are doing you shouldn't need to use
VTK classes directly and you should stick to the ParaView proxy
paradigm.

Seb

On Tue, May 15, 2012 at 4:31 AM, Tuan Ha Tran <tuan-ha.tran at insa-lyon.fr> wrote:
> Thank you very much Seb,
> I have another question : I read the simple.py and certainly, I found all
> the function about rendering, read file, etc. but I didn't find out anything
> about all the filters.
> So if a want to use these filter, in python and after, in javascript. Where
> can I find the header (to know how to use these functions - some files like
> simple.py)? Do I have to import the vtk Library or something like that so we
> can use them in ParaViewWeb?
> About the plugin, I (suppose) write a plugin, with the .xml and .cxx file
> (as instructed in the Wiki page), write .py file and place it into the
> folder plugins of working-directory.
> So, in the PWConsole, I suppose to load the plugin so it can be use in
> PWConsole? I wonder if i'm right.
> Thank you once more.
>
>
>
>
> ----- Original Message -----
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> To: Tuan Ha Tran <tuan-ha.tran at insa-lyon.fr>
> Cc: paraview at paraview.org
> Sent: Mon, 14 May 2012 15:22:55 +0200 (CEST)
> Subject: Re: [Paraview] JavaScript API - ParaViewWeb - how to call function
>
> For that you will need to know the name of the ParaView Proxy. You can
> find-out by using ParaView and the trace function.
> Then by referring to
> http://www.paraview.org/Wiki/What_is_the_full_JavaScript_API , you
> should be able to convert the Python trace to a JavaScript code.
> Moreover, if you use directly the JavaScript console of Firebug or
> Chrome, you have the completions on the ParaView object.
>
> I think in your case you should write your code as follow:
>
> p = paraview();
> var reader = plugin.load('myFile.mhd');
> filter = p.Threshold( {proxy:reader} ); // The arg is optional as the
> reader is currently active
> representation = p.Show()
> p.Render()
>
> Seb
>
> On Mon, May 14, 2012 at 5:27 AM, Tuan Ha Tran wrote:
>> Hi everybody,
>>     I have a question about the using of JavaScript API in ParaViewWeb.
>>     I succeeded in loading a file using OpenDataFile via a plugin.
>>
>>   And now I want to apply a filter to my files.
>>   When I tried to call, for example ImageThreshold
>>
>>   p = paraview();
>>   var reader = plugin.load('myFile.mhd');    //I succeeded in loading this
>> file
>>   reader = p.ImageThreshold(reader);                    // it's here I
>> want
>> to apply a filter, but I have the followed error : Object # has no
>
>> method 'ImageThreshold'  I also tried with reader = p.vtkImageThreshold
>> but
>> the same error.
>>
>>   So I want to know how to call a ParaView function in JavaScript Terminal
>> of PWConsole?
>>   Thank 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