Having finally added an A axis to my little CNC mill I've been looking for things it can do and got interested in knurling. Here's an example I did with a program I developed.
Attachment 469790
Attachment 469792
I started off thinking of writing a Mach3 wizard, but it isn't obvious how to do that and anyway I didn't want to write something that wasn't portable between machines. So eventually wrote it in Python which runs on many computers such as PCs, Macs, Linux machines including R-Pi, etc. I've attached a copy of the Python code - note that to use it you need to change the .txt extension to .py to open in an editor/debugger (I use Thonny which is free). Also I've attached a copy of a g-code file it generates. I wrote this to run on Mach3 but it should be portable - any incompatibilities people find please let me know and I'll try to fix. It could be made much shorter using a subroutine but the in-line g code will run on controllers such as GRBL that don't support them.
A couple of restrictions. It is best to make the number of circumferential "teeth" prime - in the example it's 37 around a 12.7mm diameter. This gives a "diamond pitch" of ~1mm. Also the length of the knurl should be given as an integer number of diamonds - in this case it's 10 so the length is ~10.8mm. If you don't choose a prime then at least the length and number of teeth should be co-prime, i.e. have no common factors greater than 1.
Program X zero should be the start of the knurl, Y zero the A axis, Z zero the machine table.
The tool I used is a 90 degree engraving cutter run at 6000 rpm, the maximum the machine will do. This limits the feedrate but it could probably be cut faster with a high speed spindle. This is on brass.
At the moment the auto-calculated cutting depth is possibly slightly too deep, I need to understand the geometry of the diamond-shaped pyramids better I think.