|
Not as far as I know.
For 2D CAM a very useful geometrical construct is the voronoi diagram. I've hacked together openvoronoi (floating point coordinates, points, lines, arcs (experimental) , and there is boost.polygon.voronoi (integer coordinates, points, lines, arc support was planned - not sure if it progressed).
There is also CGAL code but boost.polygon.voronoi or openvoronoi are much faster and hopefully more robust. For example output see: https://plus.google.com/photos/106188605401091280402/albums/5704527888520386193?banner=pwa
I've experimented with three types of toolpaths:
- simple offsets (inward or outward). I don't (yet) have code that links multiple offsets in a good way.
- V-carving. From the voronoi diagram a medial-axis can be produced by trimming down (discarding) the complete voronoi diagram so that only the medial axis remains. This, together with the Z-values contained in the medial-axis, is the toolpath we want for V-carving. See http://www.youtube.com/watch?v=n4P9SvT4L7g
- medial-axis pocketing. This is a smarter pocketing strategy that tries to keep the tool-engagement bounded. Various CAM advertizing-departments call these toolpaths different things (trochoidal, adaptive, high-speed, etc. etc.) but the idea is to load the tool in a predicatble way (which offset or zigzag pocketing does not)
for the voronoi algorithms see: http://www.boost.org/doc/libs/1_52_0/libs/polygon/doc/voronoi_main.htm
or: https://github.com/aewallin/openvoronoiboth of these libraries require strictly non-intersecting line-segments (or arcs), no points are allowed to lie exactly on a line-segment, and no duplicate points are allowed. This might mean more or less pre-processing needs to be done to the librecad geometry before a voronoi library is called.
If you want a "fun" programming challenge try coding the 2D offset output in the gallery (e.g. "LinuxCNC" image) over a weekend or two. The straightforward approach is to first segment-wise offset each line-segment (or produce a circle for each vertex), and then start to trim these offsets to get the final result. There are both local and global intersections to deal with - It is harder than you think! The voronoi diagram approach is different in that a map is produced so we know for each point in the 2D plane which part of the original geometry is closest. It is then almost trivial to generate a correct offset.
cheers, Anders
|