By the way. Changed my code to work in degrees mode so that toolpath would display more meaningfully. See attached. It didn't occur to me previously, but this way the debugging is easier. Interestingly the toolpath produced by my code consists of almost straight lines, while yours of curved lines. So based on the fact that mine did produce flats somehow, I would assume that there is a problem with yours
.
Dan