[Paraview-developers] How to obtain pqPipelineSource from vtkObject?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Fri Jan 22 15:39:06 EST 2016


Michael,

This isn't how things are expected to work in ParaView. I'd suggest
instead of creating a vtkXMLPolyDataReader directly in your plugin and
setting the binary string on it, create a new vtkPolyDataAlgorithm
subclass that in its RequestData() method obtains the vtp file from
the database and then sets it on an internal vtkXMLPolyDataReader and
then executes it and passes the data out.

Now you can create a plugin for this new vtkPolyDataAlgorithm and then
available for the application to use/create like other data source
proxies like readers or sphere source etc.

Utkarsh

On Tue, Jan 19, 2016 at 4:20 PM, Hillier, Michael (NRCan/RNCan)
<michael.hillier at canada.ca> wrote:
> I am having trouble figuring out how to get a pqPipelineSource from a
> vtkObject (specifically a vtkPolyData) so that I can view those objects in
> paraview from my plugin. Here is my code
>
>
>
>
>
> vtkSmartPointer<vtkXMLPolyDataReader> reader =
> vtkSmartPointer<vtkXMLPolyDataReader>::New();
>
> std::string binary_string; // I get this from a database which stores
> contents of a binary .vtp file
>
> reader->SetInputString(binary_string);
>
> reader->ReadFromInputStringOn();
>
> reader->Update();
>
>
>
> pqApplicationCore *core = pqApplicationCore::instance();
>
> pqDisplayPolicy *displayPolicy = core->getDisplayPolicy();
>
> pqView *view = pqActiveObjects::instance().activeView();
>
>
>
> pqPipelineSource* source = ??? // want to obtain from vtkObject/vtkPolyData
> somehow (vtkPolyData * pdata = reader->GetOutput());
>
> vtkSMProxy *sourceProxy = source->getProxy();
>
> sourceProxy->UpdateVTKObjects();
>
> displayPolicy->setRepresentationVisibility(source->getOutputPort(0),view,true);
>
>
>
>
>
> Any help much appreciated.
>
>
>
> Michael
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at:
> http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>


More information about the Paraview-developers mailing list