547,633 active members*
2,953 visitors online*
IndustryArena Forum > General Manufacturing Processes > Milling > Wizard for milling a knurl using A-axis

# Thread: Wizard for milling a knurl using A-axis

1. ## Wizard for milling a knurl using A-axis

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.

2. ## Re: Wizard for milling a knurl using A-axis

Following a few useful comments on another website I attach a revised version and an example output. The main differences here are -

- the space the previous version inserted between the g-code word and the value - e.g. "G00 X 5" is suppressed in case any controllers expect to see no space.
- the comment on each line of the "zigzag" portion of the file is more user friendly, going from 1 to N rather than 0 to N-1 and appears in both lines of a given zigzag.
- the method used to write to the output file is 'w' rather than 'a' which means that if a file is re-used it is overwritten rather than the new g-code being appended at the end. Mind you re-using a file is not recommended!

3. ## Re: Wizard for milling a knurl using A-axis

Yet another update, this time to correct the formula for the cut depth which was slightly too deep.