# How to interact with PV classes using C++

**URL:** https://discourse.paraview.org/t/how-to-interact-with-pv-classes-using-c/2020
**Category:** Development
**Created:** [June 12, 2019, 9:13am UTC](https://discourse.paraview.org/t/how-to-interact-with-pv-classes-using-c/2020 "2019-06-12T09:13:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Toorall](https://discourse.paraview.org/user_avatar/discourse.paraview.org/toorall/32/1992_2.png) [@Toorall](https://discourse.paraview.org/u/Toorall)
#### Post date: [June 12, 2019, 9:13am UTC](https://discourse.paraview.org/t/how-to-interact-with-pv-classes-using-c/2020/1 "2019-06-12T09:13:51Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 12, 2019, 10:23am UTC](https://discourse.paraview.org/t/how-to-interact-with-pv-classes-using-c/2020/2 "2019-06-12T10:23:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Toorall](https://discourse.paraview.org/user_avatar/discourse.paraview.org/toorall/32/1992_2.png) [@Toorall](https://discourse.paraview.org/u/Toorall)
#### Post date: [June 15, 2019, 7:55am UTC](https://discourse.paraview.org/t/how-to-interact-with-pv-classes-using-c/2020/3 "2019-06-15T07:55:26Z")

</div>

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
