Machsupport Forum

General CNC Chat => Share Your GCode => Topic started by: JohnHaine on September 13, 2021, 10:58:53 AM

Title: Wizard for milling a knurl using A-axis
Post by: JohnHaine on September 13, 2021, 10:58:53 AM
In case it could be useful I attach a little "wizard" I wrote in Python to generate the g code for cylindrical diamond knurling.  It uses a 90 degree engraving cutter, zig-zagging round the material to form the knurl.  The main point to note is that the number of "diamonds" round the work should be prime, and the length is defined in terms of the number of diamonds longitudinally.  Also attach photos of the results and example g code.

I know it isn't an embedded wizard but I thought writing in VB for Mach3 is wasted effort these days and something more portable in a modern language would be better. 
Title: Re: Wizard for milling a knurl using A-axis
Post by: Tweakie.CNC on September 13, 2021, 12:05:43 PM
Excellent work.
Can the Python can be 'run online' to generate the Gcode file ?

Tweakie.
Title: Re: Wizard for milling a knurl using A-axis
Post by: JohnHaine on September 13, 2021, 02:52:52 PM
Thanks Tweaky!

Um...not sure what you mean by "online" - I run it from Thonny on my PC (or could be Mac / R-Pi or any Linux machine), which is a Python IDE.  You give it a filename (when it asks) and it writes the code into a file with that name.  I think it might be possible, if you are running it on the same machine as Mach 3/4, to insert the full file path to the folder where Mach3/4 keeps its G-code, otherwise it just writes the file into the folder where the code is.  I run Mach 3 on an old XP machine and getting Python on XP (especially without an Internet connection) seems to be hard!  So I tend to generate the code on my office PC and save it on to a USB stick and sneakernet down to the workshop.

If only Mach 4 had used Python for macros and wizards instead of Lua...

John.
Title: Re: Wizard for milling a knurl using A-axis
Post by: JohnHaine on September 14, 2021, 08:15:30 AM
Another update, this one corrects the formula for the cut depth which was a bit too deep.