Skip to content
OpenCASCADE utility library - algorithms and convenience functions
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
include/occutils
src
.gitignore
CMakeLists.txt
LICENSE
README.md

README.md

OCCUtils

OpenCASCADE utility library - algorithms and convenience functions.

Design goals

OCCUtils aims to be

  • Simple to use: Most tasks should be accomplishable in one line of code.
  • Aid rapid development: No need to write tons of utility functions ; no need to wait for long compile-times
  • Modular: Pull in only what you need, or just copy the underlying sourcecode.
  • Clear: What you write should be what you mean: Edge::FromPoints() instead of BRepBuilderAPI_MakeEdge three-liners.
  • High-Level: Common tasks in 3D engineering should be accomplishable without diving into low level OpenCASCADE code
  • Modern: Uses features from C++17, because those make your code more readable.
  • Liberally licensed: OCCUtils is licensed under Apache License v2.0, allowing you to copy & modify the sourcecode for use in your commercial projects for free. Keep in mind that OpenCASCADE is still LGPL licensed.

Note that OCCUtils is very young and although it is used in multiple production projects, it might not have all the functionality you want or need, and might have some bugs.

If you are missing functionality, feel free to submit an issue or pull request.

Prerequisites

First install OpenCASCADE 7.x. My preferred method on Ubuntu is to use the FreeCAD daily PPA:

sudo add-apt-repository ppa:freecad-maintainers/freecad-daily
sudo apt-get update
sudo apt install libocct\*

Also you need to install a recent version of CMake & GCC. Since we use C++17 features, a recent version of both G++ and CMake is required:

sudo apt install cmake build-essential

On Ubuntu 18.04+ you don't need to do anything special to compile.

How to build

There are two preferred methods of building and installing OCCUtils

System-wide install
git clone https://github.com/ulikoehler/OCCUtils.git
cmake .
make
sudo make install

Then you can use e.g.

#include <occutils/SurfaceUtils.hxx>

using namespace OCCUtils;

// ...
auto surfOpt = SurfaceUtils::SurfaceFromFace(face);
// ...

and link with -loccutils.

git-submodule based installation

This method involves adding the repository and building it as a subproject of your CMake-based main project. I recommend doing this especially for more complex projects. However you need some knowledge of CMake to get it working and debug related issues.

In your project root directory:

git submodule init
git submodule add https://github.com/ulikoehler/OCCUtils.git OCCUtils

Then add this CMake code to your CMakeLists.txt:

add_subdirectory(OCCUtils)

and

add_dependencies( my_target occutils )
target_link_libraries( my_target occutils )

replacing my_target with the name of your build target (i.e. the first argument you give to add_executable()). The occutils CMake script will take care of the rest.

How to use

On my blog I provide examples of specific usecases for OpenCASCADE, including how to use the relevant OCCUtils functions:

You can’t perform that action at this time.