Here's a few of the links we've been referring to in discussions. Maybe we can make this sticky.
Shared Design Document
Dan's writeup on how HeeksCNC does toolpath generation
Sliptonic's writeup on HeeksCNC postprocessing
Using FreeCAD Path Video Playlist
Links and Background
Links and Background
Last edited by sliptonic on Fri Mar 02, 2018 8:08 pm, edited 3 times in total.
Re: Links and Background
A note on my existing 3D CAMalgorithms in OpenCAMLib, c++ code with python bindings, under GPL license.
Typical "dropcutter" ("axial tool projection") finish toolpath.
http://www.anderswallin.net/wpcontent/ ... 4/tux1.png
These may essentially be any toolpath in the XY plane which is the "dropped" or "projected" down onto an STL surface to produce cutterlocation points. There is a filter for reducing the number of points on straight parts of the surface. A filter for recognizing circular arcs in the principal planes (i.e. g2/3 moves) would be a good addition.
Dropcutter works with the following toolshapes. The bottom row shows compositecutters that are combinations of the toprow basic cutter shapes. Many more of these are possible to define, if desired.
http://www.anderswallin.net/wpcontent/ ... 8/all1.jpg
A stocktoleave feature is implemented thorugh offset cutters. When we want to machine a surface with a positive stocktoleave value we first offset the cutter outward, calculate the toolpath with this largerthanactual cutter, and then machine with the small original cutter. This should result in the desired surface with the given stocktoleave.
(I seem to have no good image of this idea in my blog, sorry...)
A cutter can also be "pushed" in the XY plane ("radial tool projection"). When these cutterlocation points are hooked up correctly we have a waterline toolpath:
http://www.anderswallin.net/wpcontent/ ... e_tux1.png
There are still issues with how the cutterlocation points should validly be hooked up into a waterlineloop. Your patches will be welcome!
The typical roughingstrategy is to rough or clearout "Zterraces" where each terrace is defined by a waterline and the stockdefinition. For a 3D roughing operation these waterlines calculated in 3D are thus input for a 2D roughing/clearing algorithms that is run at each Zstep.
TODO/Plans:
 Pencilmilling. By looking at the cuttercontact point with a rounded tool (BallCutter or BullCutter) it is possible to determine the surface normal at the point where we make contact with the model. Pencilmilling cutterlocations are points on the STL model where this contactnormal changes abruptly. It should be straightforward to create a mesh in the XYplane covering the whole model, then run dropcutter on all vertices in the mesh, then find places where the cutternormal changes abruptly. Optionally refine the mesh adaptively in interesting regions. Then hook up these found points into pencilmilling paths.
 Constantscallop. Again start with a mesh in the XYplane covering the whole model. Run dropcutter on this to project "wrap" the mesh down on the model. Refine adaptively to desired accuracy. Now run a "geodesic distance field" or similar (many papers/descriptions exist) algorithm on this mesh. This results in equallyspaced curves on the mesh, which at least with BallCutter will be exactly (or an approximation(?)) a constantscallop toolpath. See for example this image: http://www.graphics.rwthaachen.de/medi ... c076c1.png
 nonsimultaneous 4/5axis paths are possible, i.e. toolpaths where we do not machine while the 4/5 axis rotates are essentially just 3axis paths, but with the STL model oriented/rotated into a new position. Applying all existing 3axis oprations to rotated STLmodel should be straightforward.
My conclusion is that on the geometry/math side of things there's already a bit of work done! It's mainly the integration part into freecad that is lacking now.
Anders
Typical "dropcutter" ("axial tool projection") finish toolpath.
http://www.anderswallin.net/wpcontent/ ... 4/tux1.png
These may essentially be any toolpath in the XY plane which is the "dropped" or "projected" down onto an STL surface to produce cutterlocation points. There is a filter for reducing the number of points on straight parts of the surface. A filter for recognizing circular arcs in the principal planes (i.e. g2/3 moves) would be a good addition.
Dropcutter works with the following toolshapes. The bottom row shows compositecutters that are combinations of the toprow basic cutter shapes. Many more of these are possible to define, if desired.
http://www.anderswallin.net/wpcontent/ ... 8/all1.jpg
A stocktoleave feature is implemented thorugh offset cutters. When we want to machine a surface with a positive stocktoleave value we first offset the cutter outward, calculate the toolpath with this largerthanactual cutter, and then machine with the small original cutter. This should result in the desired surface with the given stocktoleave.
(I seem to have no good image of this idea in my blog, sorry...)
A cutter can also be "pushed" in the XY plane ("radial tool projection"). When these cutterlocation points are hooked up correctly we have a waterline toolpath:
http://www.anderswallin.net/wpcontent/ ... e_tux1.png
There are still issues with how the cutterlocation points should validly be hooked up into a waterlineloop. Your patches will be welcome!
The typical roughingstrategy is to rough or clearout "Zterraces" where each terrace is defined by a waterline and the stockdefinition. For a 3D roughing operation these waterlines calculated in 3D are thus input for a 2D roughing/clearing algorithms that is run at each Zstep.
TODO/Plans:
 Pencilmilling. By looking at the cuttercontact point with a rounded tool (BallCutter or BullCutter) it is possible to determine the surface normal at the point where we make contact with the model. Pencilmilling cutterlocations are points on the STL model where this contactnormal changes abruptly. It should be straightforward to create a mesh in the XYplane covering the whole model, then run dropcutter on all vertices in the mesh, then find places where the cutternormal changes abruptly. Optionally refine the mesh adaptively in interesting regions. Then hook up these found points into pencilmilling paths.
 Constantscallop. Again start with a mesh in the XYplane covering the whole model. Run dropcutter on this to project "wrap" the mesh down on the model. Refine adaptively to desired accuracy. Now run a "geodesic distance field" or similar (many papers/descriptions exist) algorithm on this mesh. This results in equallyspaced curves on the mesh, which at least with BallCutter will be exactly (or an approximation(?)) a constantscallop toolpath. See for example this image: http://www.graphics.rwthaachen.de/medi ... c076c1.png
 nonsimultaneous 4/5axis paths are possible, i.e. toolpaths where we do not machine while the 4/5 axis rotates are essentially just 3axis paths, but with the STL model oriented/rotated into a new position. Applying all existing 3axis oprations to rotated STLmodel should be straightforward.
My conclusion is that on the geometry/math side of things there's already a bit of work done! It's mainly the integration part into freecad that is lacking now.
Anders
Re: Links and Background
And now a note on my 2D library, OpenVoronoi, also c++ code with python bindings, under GPL license.
The voronoidiagram is essentially a proximitymap, dividing the plane into regions where the interior of each region "belongs" to a certain inputgeometry object because points in this region are closer to the inputobject than to any other object.
Voronoi diagrams (or their dual, Delaunay triangulations) have many uses in computational geometry.
An obvious use is the generation of 2D offsets:
https://picasaweb.google.com/1061886054 ... 8267087346
It is obviously possible to also produce "Profiling" toolpaths where we only have an input profile, not a closed polygon. I have not looked at this yet, but it should be straightforward.
Another one is the medialaxis, loosely defined as the points interior to a geometry which are as far as possible from the boundaries of the input geometry:
https://picasaweb.google.com/1061886054 ... 0471914946
These can be used for Vcarving: http://www.youtube.com/watch?v=n4P9SvT4L7g
A more interesting development is "smart" pocketing where the idea is to guarantee that the tool does not cut into the material exessively (such as it does with conventional offset or zigzag pocketing strategies). This is still under development but shows some promise:
http://www.youtube.com/watch?v=lfIU_gv0iB8
Notes:
 A polygon library (libarea, clipper, kbool) will usually not take circular arcs as input. Circular arcs must be approximated with many short linesegments for these libraries. A voronoidiagram algorithm that supports circular arcs does not have this limitation. Both types of libraries can produce circular arcs in the output (e.g. offsets).
 An alternative to OpenVoronoi is Boost.Polygon.Voronoi (Boost license) which is not officially part of Boost yet, but shows some promise. My benchmarks indicate it is currently faster than OpenVoronoi.
 Neither OpenVoronoi nor Boost.Polygon.Voronoi support circular arc input currently, but support is planned.
 There's also a voronoi algorithm in CGAL, but everyone seems to agree it is slow and buggy.
have fun,
Anders
The voronoidiagram is essentially a proximitymap, dividing the plane into regions where the interior of each region "belongs" to a certain inputgeometry object because points in this region are closer to the inputobject than to any other object.
Voronoi diagrams (or their dual, Delaunay triangulations) have many uses in computational geometry.
An obvious use is the generation of 2D offsets:
https://picasaweb.google.com/1061886054 ... 8267087346
It is obviously possible to also produce "Profiling" toolpaths where we only have an input profile, not a closed polygon. I have not looked at this yet, but it should be straightforward.
Another one is the medialaxis, loosely defined as the points interior to a geometry which are as far as possible from the boundaries of the input geometry:
https://picasaweb.google.com/1061886054 ... 0471914946
These can be used for Vcarving: http://www.youtube.com/watch?v=n4P9SvT4L7g
A more interesting development is "smart" pocketing where the idea is to guarantee that the tool does not cut into the material exessively (such as it does with conventional offset or zigzag pocketing strategies). This is still under development but shows some promise:
http://www.youtube.com/watch?v=lfIU_gv0iB8
Notes:
 A polygon library (libarea, clipper, kbool) will usually not take circular arcs as input. Circular arcs must be approximated with many short linesegments for these libraries. A voronoidiagram algorithm that supports circular arcs does not have this limitation. Both types of libraries can produce circular arcs in the output (e.g. offsets).
 An alternative to OpenVoronoi is Boost.Polygon.Voronoi (Boost license) which is not officially part of Boost yet, but shows some promise. My benchmarks indicate it is currently faster than OpenVoronoi.
 Neither OpenVoronoi nor Boost.Polygon.Voronoi support circular arc input currently, but support is planned.
 There's also a voronoi algorithm in CGAL, but everyone seems to agree it is slow and buggy.
have fun,
Anders
Re: Links and Background
An update: As of August 2018 both Openvoronoi and OpenCamLib are licensed LGPL
Re: Links and Background
That's good news! Some time ago I had a look at the docs of opencamlib. There seems to exist already code for different forms of mills. Perhaps we can reuse it.

 Posts: 689
 Joined: Wed Mar 27, 2019 10:45 am
Re: Links and Background
Here is a reddit list of many deprecated and recent opensource software for CNC and CAM. It seems the list has been steadily updated starting about a year ago with posters comments.
https://www.reddit.com/r/CNC/comments/a ... =post_body
Of notable interest maybe the Nesting tools or some Plasma cutter oriented pieces of software. Perhaps this will already be known to the PathWB gurus...perhaps it will inspire. Hopefully there are things in there that may be of use from a purely functional/license point of view.
Also...FreeCAD PathWB is mentioned
https://www.reddit.com/r/CNC/comments/a ... =post_body
Of notable interest maybe the Nesting tools or some Plasma cutter oriented pieces of software. Perhaps this will already be known to the PathWB gurus...perhaps it will inspire. Hopefully there are things in there that may be of use from a purely functional/license point of view.
Also...FreeCAD PathWB is mentioned