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

Christian Richter christian.richter at ovgu.de
Tue Jan 1 05:50:55 EST 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: filewatcher.tar.gz
Type: application/x-gzip
Size: 10240 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130101/44f5faa8/attachment.bin>


More information about the ParaView mailing list