OpenCAMlib and OpenVoronoi toolpath examples

There might be renewed hope for a FreeCAD CAM module. Here are some examples of what opencamlib and openvoronoi can do currently.

The drop-cutter algorithm is the oldest and most stable. This shows a parallel finish toolpath but many variations are possible.


The waterline algorithm has some bugs that show up now and then, but mostly it works. This is useful for finish milling of steep areas for the model. A smart algorithm would use paralllel finish on flat areas and waterline finish on steep areas. Another use for the waterline algorithm is "terrace roughing" where the waterline defines a pocket at a certain z-height of the model, and we run a pocketing path to rough mill the stock at this z-height. Not implemented yet but doable.


This shows offsets calculated with openvoronoi. The VD algorithm is fairly stable for input geometries with line-segments, but some corner cases still cause problems. It would be nice to have arc-segments as input also, but this requires additional work.


The VD is easily filtered down to a medial-axis, more well-known as a V-carving toolpath. I've demonstrated this for a 90-degree V-cutter, but toolpath is easy to adapt for other angles. Input geometry comes from truetype-tracer (which in turn uses FreeType).


Finally there is an experimental advanced pocketing algorithm which I call medial-axis-pocketing. This is just a demonstration for now, but could be developed into an "adaptive" pocketing algorithm. These are the norm now in modern CAM packages and the idea is not to overload the cutter in corners or elsewhere - take multiple light passes instead.


The real fun starts when we start composing new toolpath strategies consisting of many of these simple/basic ones. One can imagine first terrace-roughing a part using the medial-axis-pocketing strategy, then a semi-finish path using a smart shallow/steep waterline/parallel-finish algorithm, and finally a finish operation or even pencil-milling.

8 thoughts on “OpenCAMlib and OpenVoronoi toolpath examples”

  1. Anders, this all looks awesome!

    I would love to play with the medial axis pocketing code, how best to get to grips with this code and make output with arbitrary inputs? I really should sort out my quick GUI for the Vcarving with openvoronoi that I hacked together, I should contribute this back to your project as an example use case.

    Thanks for the amazing works and for making it all public!

    1. Hi Ed,
      Thanks for your message. I have been busy with other things, but when I find time I could do a 'tutorial' style blog post on using openvoronoi - this should help you get started. The V-carving path is quite easy to generate, the adaptive-machining path much less so (the current code is just a preliminary hack).


  2. Hi Anders,

    Very great work!!! I am staring to work on CAM for laser microprocessing. I am trying to perform a tool path generator, and your way looks like very easy to use. My question is: does your library work on windows? I mean for example using CMake+ Visual C++. I hope it works.
    I really appreciate any help you can provide me.
    Thanks a lot.

    1. Hi Rene,
      There is no build-script for Windows, but it should be possible to compile both opencamlib and openvoronoi as they are standard C++ that use the Boost libraries.
      It would be nice if you can comment on github if you have any issues with compiling for Windows or if you succeed.

      1. Hi Anders,

        I am just interested in generating tool paths in 2D as you show in your examples. OpenCAMlib also generates tool paths? or only OpenVoronoi does?

        1. opencamlib is for 3D cutter projection and openvoronoi is for 2D calculation of the voronoi diagram. From the voronoi diagram you will still need some processing to produce the toolpaths you want.

  3. Hi Anders,

    Sorry for bothering you. I was able to build the libraries by using Visual C++ 2010. I would like to test it. Could I get an example to test? Just a simple example to see that the libraries work fine by using VC++. If it does work, we can think in writing the process either here or the repository.
    Best regards.

  4. opencamlib examples in python:
    the translation from python to c++ should be obvious

    openvoronoi python examples
    but also some tests are available in c++

    my scripts use VTK for visualization - if you can install that easily on Windows it will be much easier to see what is going on - or perhaps you have your own 2D/3D viewport already in VC++?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.