[Paraview] ParaviewWeb : Adding interactive slice filter to pipeline

Sebastien Jourdain sebastien.jourdain at kitware.com
Mon May 2 15:59:59 EDT 2011


Hi Raj,

Another thing. You should do that to set origin and normal.

var plan = sliceFilter.getSliceType();
plan.setOrigin(0,0,0);
plan.setNormal(1,0,0);

in fact the methods SetSliceOrigin/Normal are helper methods on python
objects and not properties. You can notice it because of the capital S in
the set. This must come from the python trace. If it was a property in
python it would have been written:

sliceFilter.SliceNormal = [1,0,0];

Hope this help you to understand how it is working underneath and how to
easily convert Python generated code into similar JavaScript one.

Seb

On Mon, May 2, 2011 at 8:59 AM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> Hi Raj,
>
> You are not getting the propers bounds when you directly access them like
> that:
>
> > reader.Bounds
>
> In fact, if you validate each line that you wrote inside the JavaScript
> console of your browser, you could have seen that Bounds was not part of the
> reader proxy. Moreover, it goes against the idea that Proxy do not have
> methods/fields but only properties that can be set/get based on their name.
> So eventually, it could have been reader.getBounds(). Although, bounds is
> not a property of the reader.
> In order to get the right informations, you do need to do call a method on
> ParaView:
>
> > var dataInfo = pv.GetDataInformation({proxy:reader});
>
> The returned value is not a proxy, it's just a data structure with all the
> data informations of the given proxy. (Fields name, Time, scalar range,
> bounds, memory consumption on the server...)
>
> Then you can do :
> > sr.setPlaceWidget(dataInfo.Bounds);
>
> I do believe that you  look at the file ParaWebFunctions.js inside the
> PWApp to get that close. If not, it could provide you some help on how to
> handle some common actions.
>
> Thanks,
>
> Seb
>
> On Fri, Apr 29, 2011 at 7:25 PM, Rajvikram Singh <rajvikrams at yahoo.com>wrote:
>
>> Hi
>>    I am trying to add a simple slice filter to a ParaviewWeb client that
>> users could use interact with a volume. The bundled PWApp application does
>> this already and so I tried to go through the code and looked at some Python
>> examples. I was able to get an interactive widget to render but it shows a
>> blank slice. Also the bounds are not correct since the volume is 'flat' and
>> what I see is a cube.
>>
>> Here's the code I'm using :
>>
>> var reader = pv.OpenDataFile({filename : "test.vtk"});
>>     var view1 = pv.CreateIfNeededRenderView();
>>     pv.Render();
>>
>>     var sliceFilter = pv.Slice({Input : reader});
>>     sliceFilter.SetSliceNormal = [0,0,1]; // sliec along Z
>>     sliceFilter.SetSliceOrigin = [0,0,0];
>>     sliceFilter.SetSliceType = 'Plane';
>> //    sliceFilter.SetInputBounds = pv.GetDataInformation.Bounds;
>>
>>     var sr = pv.CreateBindedWidget({proxy : sliceFilter.getSliceType(),
>> view : view1});
>>     sr.setPlaceWidget(reader.Bounds);
>>     sr.setEnabled(1);
>>     sr.setVisibility(1);
>>
>>     var dataRep1 = pv.Show({proxy : sliceFilter});
>>
>>
>>     pv.SetDisplayProperties( {
>>     proxy : sliceFilter,
>>     view  : view1,
>>     Representation : 'Surface',
>>     } );
>>
>> I'm attaching a screenshot of what's rendered in my browser. I'm obviously
>> not setting some property correctly .. I just can't tell which one.
>>
>> Thanks in advance
>> Raj
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110502/8a99969b/attachment-0001.htm>


More information about the ParaView mailing list