[Paraview] How to change the Representation within a Plugin ?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Jan 2 09:10:37 EST 2013


Try calling the following before  src->updatePipeline() before
attempting to create the representation. The reader hasn't been
executed yet and hence it doesn't provide any information about what
type of data it will produce and hence createDataRepresentation()
cannot create any data-representation for it. updatePipeline() forces
the reader to execute i.e. it's RequestData() will get called and then
the rest should work as expected.

Utkarsh

On Tue, Jan 1, 2013 at 5:50 AM, Christian Richter
<christian.richter at ovgu.de> wrote:
> Hi,
>
> I've written a Plugin to use Paraview as "LiveView" for our simulation Data.
> With a QFileSystemWatcher the Plugin updates the filenames of the
> fileseries-reader everytime a new result-file was written to disk.
>
> Now I want to change the Representation from Point to Point Sprite
> automaticly after the source is created and set some standard properties.
> In Pythion I used:
>         xreader=liggghts_Reader(guiName="liggghts_dump")
>         xreader.FileNames=files
>         SetDisplayProperties(xreader, Representation="Point Sprite")
>         DataRepresentation1 = Show()
>         DataRepresentation1.PointSpriteDefaultsInitialized = 1
>         DataRepresentation1.Texture = []
>         DataRepresentation1.RadiusTransferFunctionEnabled = 1
>         DataRepresentation1.RadiusMode = 'Scalar'
>         DataRepresentation1.Representation = 'Point Sprite'
>         DataRepresentation1.RadiusArray = [None, 'radius']
>         DataRepresentation1.RadiusIsProportional = 1
>
> And I tried this in my C++Plugin:
>     src = builder->createReader(QString("sources"),type, files, s); //works
>     src->rename(type);
>
>     pqActiveView& myActiveView=pqActiveView::instance();
>     this->RenderView=myActiveView.current();
>     pqDataRepresentation *repr =
> builder->createDataRepresentation(src->getOutputPort(0), this->RenderView);
>     vtkSMPropertyHelper(repr->getProxy(),"Representation").Set("Point
> Sprite"); //segfault
>
> but get segfault at last line because repr is still NULL.
> I attached the code and here is a video where you can see the Plugin
> working.
> http://youtu.be/5CGGf-kPcEQ
>
> best,
> Christian
>
>
> _______________________________________________
> 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