Open CASCADE for your project

Lahiru Dilshan
4 min readMay 17, 2022

--

Open CASCADE Technology (OCCT) is a C++ library that is designed for production of domain specific CAD/CAM applications. The most important feature of this library is it is free. But the applicability and capacity of this library is huge. Many open source CAD/CAM products are based on this. With the help of huge community and development team, developers, users, researchers and commercial product developers can use it for different industrial applications, researches and many more.

Download Open CASCADE

If you are willing to use Open CASCADE for your project, there are couple of ways you can integrate it. You can easily download installer or source code from the download page. At this moment, latest version is 7.6.0.

Download Open CASCADE latest version

If you are willing to explore source of the Open CASCADE you can download source package. If you are new to this it would be better if you can use package installer. In this article, package installer is used to setup Open CASCADE project in Visual Studio. After downloading package installer, you can simply install as any other software. Then move on to create new project using Visual Studio. You can simply download Visual Studio latest version if you are not already installed.

Setup project in Visual Studio

After installing Open CASCADE, create new project in Visual Studio. For that click on Empty Project and click Next.

Create empty project in Visual Studio

After that, configure your project by giving valid name and set path to save. Then click Create to finish the process.

Configure Visual Studio

Create first source file. Simply right click on Source file -> Add -> New Item. Then add valid name to the file and Add.

Add new Source File for the project

In the added source file, following code snippet is added. That is for make sphere shape using Open CASCADE class. But you can see there are errors since we did not connect library to the project. There will be another article describing primitive object generation.

Testing code

Setup Open CASCADE

As a first step you have to go to the installation directory of Open CASCADE. Here you can see inc directory which includes all the header files of Open CASCADE. Copy the path to this folder and go to the properties of the project.

Copy the path of “inc” folder.

Paste the copied path to additional include directories under C/C++->General tab.

Set path variable to additional include directories

Make sure your platform and configuration as shown in the previous image. With that change you can see all the errors in the code will remove.

Errors will remove after setting path

Remove Linker errors

When you try to build the given source code, there are lots of errors coming out. Most of them are indicating “unresolved external symbol”. To solve that, we have to specify all the libraries in linker option for the project.

Linker erros

For that, we have to include all the libraries which are useful for us. To do that, we can copy the symbol from output window and search it in the linker library. Go to Open CASCADE installation folder and win64 -> vc14 -> lib . Then search the symbols. Here I use Far file manager which is easy in this step. You can navigate to the above directory and press Alt + F7 to open search dialog. Then paste the copied symbols to search.

Search missing symbols

Then you can find corresponding libraries which need to add to the linker. Add them to Linker -> Input -> Additional Dependencies. Path to this lib folder should add to Linker -> General -> Additional Library Directories.

Add additional libraries to linker

Most cases, here the list of libraries that need to be added to additional dependencies.

TKernel.lib
TKTopAlgo.lib
TKPrim.lib

Build successfully

With all these changes you can build and run the program without any errors. Here you can test that by placing debug point.

Program runs!

Anyone who are interested in 3D modelling this will be a good entry point.

--

--

Lahiru Dilshan

Geometry Maestro | Software & Mechanical Engineer | Crafting Virtual Realities 🚀