How to interact with PV classes using C++

(Tural) #1

Hello Everyone!

I have created a plugin for PV that creates unstructured grid. But to load the generated grid I need to drug and drop it into PV.
(Current version of my plugin has front end in ParaView, I mean buttons and textLines, but back end (generation of unstructured grid) is a simple c++ code, that does not interact with ParaView classes for now).

So next step I need to write a code that will automatically load and show the grid in ParaView.

But I don’t know how to interact with ParaView classes using C++.

Can you show me at least some basic functionality, for example how to change background color or how to Render a cone from sources. And if you have a good manual, please share.

I need to know the libraries I should import, and objects I can use.

Thank you in advance!

(Mathieu Westphal (Kitware)) #2

See Examples/Plugin and https://gitlab.kitware.com/paraview/paraview/blob/master/Utilities/Doxygen/pages/PluginHowto.md

(Tural) #3

Thank you Mathieu for your reply.
I checked this link, but it mainly describes how to write plugins using xml.
I understood that it is a preferred way of writing plugins, and I will try to understand its logic later.
But for now I wanted to use C++ API to write the plugin.
I found functions to load a grid:

fileList.append(“grid.vtu”);
file = pqLoadDataReaction::loadData(fileList);

and how to reload:

pqReloadFilesReaction::reload();

I don’t need much to do at server side.
I need only to load and reload a grid (And I found how to do it),
Check if a file is open, change its representation and apply after loading.

To change the representation I tried to use:

vtkSMPropertyHelper(file->getProxy(), “Representation”).Set(“Wireframe”);
but it does not work.

If it is possible, can you tell me how to do that?

Update:
I found a way to Apply after loading:

pqPropertiesPanel::setAutoApply(1);
file = pqLoadDataReaction::loadData(fileList);
pqPropertiesPanel::setAutoApply(0);

So now the main problem is to Change Representation to “Surface with Edges” and to check if the file is open