Having got this program cutting a pair of flats @0 and 180 degrees, I though that before I 'put it away' I'd try and cut a full hexagon, so flats at 0, 60, 120, 180, 240 and 300 degrees.
Well it didn't
![:bang:](https://madmodder.net/Smileys/default/BangHead.gif)
Only 0 & 180 worked - the rest calculated increasingly large opposite sign cutter movements ie outwards. It dawned on me that the cos function needed to be limited to angles between plus and minus half of the span term, (so +-40 degrees usually) where as the rotation of the work piece needs the actual angle being used. So I split it up into two formats with a variable for the cosine function and a separate variable for the angular positioning.
This worked fine until I came to the case of a flat at 300 degrees, 300 plus the angle (usually 80 degrees) is larger than the M19 spindle positioning function will accept, being limited to 0-359.9 degrees - so another tweak was added to correct this, and lo and behold it is now a general function that will cut a flat at any angle I dictate in the R10 variable on the first line.
So have a picture of a hexagon
![:ddb:](https://madmodder.net/Smileys/default/dancenana.gif)