[Paraview] Paraviewweb

Sebastien Jourdain sebastien.jourdain at kitware.com
Sun Apr 8 09:44:00 EDT 2012


Hi Jane,

keep the prarview mailing list in the loop so anyone could contribute and learn.

In your case that will be pretty simple.
If you use jQuery as JavaScript library that could look like that:

var sourceProxy = paraview.FindSource({name:"Fluid_f2.vtk"});
var representation = paraview.GetDisplayProperties({proxy: sourceProxy});
$('.my-button-class').click(function() {
  if($(this).toggleClass("showLabel").hasClass("showLabel")) {
    representation.setSelectionPointLabelVisibility(1);
  } else {
    representation.setSelectionPointLabelVisibility(0);
  }
});

Or you can create a python script on the server side that can be
called from the JavaScript.
For more details on that you can read the plugin documentation of
ParaViewWeb here.

http://www.paraview.org/Wiki/ParaViewWeb_Plugins

Seb

On Sun, Apr 8, 2012 at 4:10 AM, Jane Hickmott <jane.hickmott at yahoo.com> wrote:
> Thank you, Seb.  Much appreciated.  Sorry I'm a novice in Javascript.  Here
> is a python trace of what I would like to accomplish - can anyone please
> show me how to convert this to javascript?  Many thanks.
> As an aside is there no way to call an external python module from within
> javascript?  That would solve everything.
>
> Jane.
>
> try: paraview.simple
> except: from paraview.simple import *
> paraview.simple._DisableFirstRenderCameraReset()
>
> Fluid_f2 = FindSource("Fluid_f2.vtk")
> DataRepresentation1 = GetDisplayProperties(Fluid_f2)
> RenderView1 = GetRenderView()
> DataRepresentation1.SelectionPointLabelVisibility = 1
>
> RenderView1.InteractionMode = 'Selection'
>
> RenderView1.CameraClippingRange = [19767.705902611211, 38094.489486240847]
> RenderView1.InteractionMode = '3D'
>
> Render()
>
> ________________________________
> From: Sebastien Jourdain <sebastien.jourdain at kitware.com>
> To: Jane Hickmott <jane.hickmott at yahoo.com>
> Cc: "paraview at paraview.org" <paraview at paraview.org>
> Sent: Saturday, 7 April 2012, 19:29
> Subject: Re: [Paraview] Paraviewweb
>
> Hi Jane,
>
> The best thing to do to figure out what is needed in your use case, is
> to load your state inside ParaView and do the action that you want to
> achieve while the Python trace is recording your changes.
>
> Once you get the trace of your actions you can either convert that
> code to JavaScript or write a plugin that execute somehow the same
> action in Python as we are using python to write ParaViewWeb plugins.
>
> The access of the trace mechanism is inside the Tools menu of ParaView.
>
> If you need some help to figure out the conversion between Python and
> JS, just post the trace on the mailing list.
>
> I'm glad you managed to produce your own first Web application using
> ParaViewWeb.
>
> Seb
>
> On Sat, Apr 7, 2012 at 6:44 AM, Jane Hickmott <jane.hickmott at yahoo.com>
> wrote:
>> Hi Paraview community!
>> I am trying to develop a paraviewweb application that involves loading of
>> a
>> state file plus the creation of a 'button' to allow data labels to appear
>> on
>> the plot.  I can load the state file but have no idea how to create the
>> necessary button and functionality.  I would be grateful to anyone kind
>> enough to give me a few pointers.  Thank you.
>>
>> Jane
>>
>> _______________________________________________
>> 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