Using OCCT with VTK and Qt on Linux


I have successfully integrated Qt and Vtk on my Linux machine and am able to develop applications which are build with CMake. I would like to add OCCT to my project for the modeling features of my application. I have several questions about the installation and integration of OCCT with the other technologies:

1. Do I need all the otherr 3rd party tools to work with the libraries? The GUI is dealt with Qt while visualization is dealt with Vtk. Does the model generated need to be displayed in a OCCT gui window or can it be displayed in a vtk window? If I don't need the 3rd party tools, how do I go about building and configuring the source?

2. Once I successfully build and install the source code, how do I tell my CMakeLists.txt file to look for OCCT?

3. I need to save a point from vtk to an OCCT data structure and vice versa. Any help in this regard?


AP's picture

Hi Sahithya,

for the main question about how to integrate vtk qt and occ:

VtK is a scenegraph library so as long as you pass it triangles you can display them inside a vtk window.
although Occ has a viewport function similar to Vtk, occ does not rely on visualization, all the operations you make can compute on memory only, this means you can link occ with any scenegraph software (coin3d,openscenegraph,hoops3d,vtk)

the process is the same:

within occ every Brep Object can be triangulated as well as as the polylines of the edges of the BREP's, all you need to do is create a function that converts a Brep Object from occ into an array of triangles/normal's, and then with this triangle array simple create a vtkmesh and for the polylines a vtkpolyline and display it in your viewport. if the Brep changes update the vtkmesh.

Interaction will be a bit harder than simply displaying objects in vtk, because you will need to associate the vtk object to a name and the Brep object with the same name, so that when users click on the vtk object you can search for the Brep object from a list that you maintain.

Hope this gives you an idea.

the cmake stuff will be the easiest check the work from the occ community edition they use cmake you might just simply use that version to begin with.