GRZ Software Blog

News and tips for MeshCAM

Offset Pocketing

Testpocket

Offset pocket algorithms have always been a problem for me. I spent a lot of time writing 3 or 4 different chunks of code and all have had problems. Anyone who’s ever written one will tell you that they are extremely difficult to get right because of the limitations of floating point numbers. Academic papers have outlines inconsistencies in several very high-end modeling kernels when it comes to generating offsets. A second problem that applies to MeshCAM more than some other 2D programs is that the pocket curves generated by it can be huge- this causes so much intermediate data to be generated that it’s difficult to debug any errors. I had finally decided that I would never have any offset pocket code that I could feel comfortable unleashing on my users. Instead I implemented zig-zag pocketing in a way that should be nearly bulletproof after it’s been put through use for a few months.

While waiting on a long recompile the other day I was going through some web links I had accumulated. I came across an old code library, made for a totally different purpose, that I could apply to the pocket problem. Within a few hours I had the basics of a working pocket algorithm that has yet to fail. The best part is that it only took 300 lines of new code I don’t have islands supported yet but that should be relatively straight forward. If all goes well then I’ll go ahead and license the library and include it in MeshCAM as a roughing option.

For those who are interested I’ll point you in the direction of the paper that gave me the initial idea here: www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf . My implementation is very different but the approach in the paper is different enough than the usual ones that it sent me in a new direction.

Comments