John Haine | 06/09/2021 09:17:26 |
5563 forum posts 322 photos | The recent thread on knurling tools triggered me to go back to a project I had in mind to try knurling on my CNC mill using the rotary axis. I wrote a little spreadsheet to generate the g-code. Basically it uses an engraving cutter to mill a spiral groove along the workpiece whilst rotating it - initially for simplicity I'm making it move for one full lead while rotating 1 turn. On a half inch bit of brass that's ~41mm lead The cutter has a 90 degree point with a small flat (basically a PCB engraver). Hare are some pics of the first trial. Came out quite well though it took a long time - just over an hour. I wound't want to do it much faster as the spindle speed is a bit low (~6000 rpm) for the cutter. Also the depth of cut is slightly too large as I forgot the flat on the end of the cutter, and the number of "teeth" could probably be reduced. Sufficiently good though that a better "wizard" that can generate shorter knurls is probably worth writing, though the calculations are more involved. I now have some knurled bar to make a small batch of thumb nuts! Mod edit: rotated photo. Edited By SillyOldDuffer on 06/09/2021 10:50:04 |
Ian Johnson 1 | 06/09/2021 10:26:09 |
381 forum posts 102 photos | That turned out nice, the crests look sharp and well formed. I did something similar with my 4th axis to produce spliced thumb nuts. I used the corner of a 6mm end mill. I wonder if it would work on a spiral to produce a knurl like yours? IanJ |
John Haine | 06/09/2021 11:04:59 |
5563 forum posts 322 photos | I have seen something on the web about using an endmill, but have never been able to find it again! Difficult to do a fine knurl as I think you have to have the cutter offset to one side and at 45* to the axis, so anything but a small cutter produces quite a wide tooth. The engraving cutters are carbide and about a fiver for 10 from China! |
IanT | 06/09/2021 11:44:05 |
2147 forum posts 222 photos | John, I'm not a CNC user but I am curious how you use a spreadsheet to generate G code? Is this process automated or are you just doing the calculations in the spreadsheet and then hand coding the results into your G code? Regards, IanT |
DC31k | 06/09/2021 12:16:05 |
1186 forum posts 11 photos | Could you write a few words on the 'number of starts' to diameter ratio you have chosen please. I think that equates to where you say "the number of "teeth" could probably be reduced" . In principle, this would be possible on a manual lathe with live tooling (Dremel in the toolpost) but a major challenge is indexing the part for the multiple starts. I wonder if it would be possible to use an internal gear meshing with an external gear of the same number of teeth between chuck and backplate. |
Martin Connelly | 06/09/2021 12:37:33 |
![]() 2549 forum posts 235 photos |
The photo shows the process using a marker pen on some tube. The example looks to have about 36 passes in each direction, 10° offset per pass. A spreadsheet could be used to calculate the data for different angles and pitches for each pass as a function of the number of passes in each direction. You probably need to start off with this figure since you want an integer number of passes so an offset for each start where the offset angle divides into 360° without a remainder. So for example 13° would be no good. You then need to calculate the lead per rev to give the required helix angle which then gives rise to the total number of degrees for the given axis travel. Write a gcode program with a couple of simple loops, one for left hand spirals and one for right hand spirals that takes the given data to produce the knurls. You could probably write a fully parameterised gcode program to do the calculations rather than use a spreadsheet but that only becomes preferable if you are going to do a lot of CNC knurling. Martin C Edited By Martin Connelly on 06/09/2021 12:40:38 |
John Haine | 06/09/2021 12:39:05 |
5563 forum posts 322 photos | Ian, the sheet does both. It has a section that calculates the dimensions, feeds etc needed, then these are converted into g code using formulas such as this: ="G00 X1 Y0 Z"&($H$3+1+C3/2) The first bit quotes just writes G00 X1 Y0 Z into the cell. The & symbol in Excel concantenates this with what comes afterwards, which is the result of the calculation in the brackets which just contains standard cell references. The result in this case (for certain parameters) is G00 X1 Y0 Z67.595 I'm cheating here because I've inserted some of the numbers by hand, but in other examples I've done all the numeric values are inserted from other cells in the sheet. So once I've built the sheet I can generate the code for specific dimensions by just changing the parameters. Done things like tapers, cams, crossing out, special pallet profiles for clocks etc. |
John Haine | 06/09/2021 12:55:01 |
5563 forum posts 322 photos | Martin, actually it's 42 passes in each direction and the "tooth angle" is 8.571 degrees. It makes one cut right-to-left turning 360*, then another L-R turning another 360 in the same direction. Then advances by 8.571* and repeats. Since the diameter is 12.7mm the leads is pi x 12.7 = 39.898 mm for 90* diamond knurls. The A axis always goes the same way to avoid backlash problems. This works when the length is equal to the lead, for shorter lengths it's more involved especially if you want to avoid lots of waits while the rotary axis moves to the next position. DC31K, I started by thinking how deep the "teeth" should be for comfy gripping - I decided no more than 0.5mm. Then had some geometry for the depth of cut for a square tooth and used a spreadsheet goal-seek to find a convenient cut depth to give an integer number of teeth. Bit of trial and error gave me 42 and a cut depth of 0.492 mm. Actually it's less than this as the geometry isn't quite as I thought when you cut crossing "threads" and the peak diameter is reduced to 12.15mm. Edited By John Haine on 06/09/2021 12:56:22 |
JasonB | 06/09/2021 13:01:28 |
![]() 25215 forum posts 3105 photos 1 articles | From a previous thread trying to do it on a lathe is not ideal a syou need a faster helix more like 0.25tpi for a 1/2" piece of stock. These sketches were doen at the time, left and right hand cut at largest tpi on thelathe Same thing but with multiple starts gives very long diamond shapes But if you can increase the lead the single left and right cut looks more like thios and with multiple starts you get the usual pattern from wheels with 45deg teeth If you have CAD then it's quite easy to play about with the depth of the Vee cut, helix angle and number of starts so you get a pointed crest. John I wonder if a chamfer mill with it's two flutes would speed things up for you as they are a bit more robust than engraving cutters and having two flutes can be fed at twice the rate |
IanT | 06/09/2021 13:08:30 |
2147 forum posts 222 photos | Thank you John - I used to know Excel reasonably well - so I might actually be able to figure this out. I have been tempted into thinking about a really cheapie CNC engraver just to learn a little more. I have found the 3D Printer useful for specific things (it's certainly not a do-all solution of course) but I'd have to dust off the few remaining spare brain cells to cram anymore in ! Regards, IanT |
DC31k | 06/09/2021 14:18:52 |
1186 forum posts 11 photos | Posted by IanT on 06/09/2021 13:08:30:
Thank you John - I used to know Excel reasonably well - so I might actually be able to figure this out. Could I bang the drum a little for learning a programming language (e.g. Python) for this task? The code used to make the above is a bit of preamble - setting up your variables - and then a lot of looping, with one parameter increasing each time until the loop is finished. In a programming language with inbuilt looping capability, this is easy. In a spreadsheet, it is more difficult. I would say using a spreadsheet to produce G-code is comparable to milling in a lathe: possible but hard work. --- Would it be correct to say that if you want a square base to your pyramid, the helix angle of the thread has to be 45 degrees? So in that sense, it is not a variable - you have to pick a lead that results in a 45 degree helix angle for your diameter. |
John Haine | 06/09/2021 14:56:00 |
5563 forum posts 322 photos | Actually no looping at all in the spreadsheet, the g code uses a subroutine and the calling statement includes an L word, L42 in this case, which calls the subroutine 42 times. But I agree that a programming language would be better. In this case Mach3 includes an ancient dialect of Visual Basic which is the natural though unfortunate choice as all its native wizards use it. |
JasonB | 06/09/2021 15:56:39 |
![]() 25215 forum posts 3105 photos 1 articles | Posted by DC31k on 06/09/2021 14:18:52:
Would it be correct to say that if you want a square base to your pyramid, the helix angle of the thread has to be 45 degrees? So in that sense, it is not a variable - you have to pick a lead that results in a 45 degree helix angle for your diameter. You want a helix with a pitch calculated by the dia of the workpiece less twice Vee deep x pi So for example 12mm dia work with 1mm deep V would be 10 x 3.142 or 31.42mm pitch |
John Haine | 07/09/2021 06:50:20 |
5563 forum posts 322 photos | Jason, thanks for the tool suggestion, I'll investigate. |
John Haine | 09/09/2021 11:01:29 |
5563 forum posts 322 photos | Posted by DC31k on 06/09/2021 14:18:52:
Could I bang the drum a little for learning a programming language (e.g. Python) for this task?
I'm looking further into writing a wizard for this - not a true wizard since it won't run inside Mach3 since I don't want to lose it when my Mach3 PC finally collapses and I move to a different CNC package. Also don't want to tie the code to a superannuated visual basic (not even Microsoft's). So I think Python, I've done a little bit of Python programming and I like the language. So what I want to do is to write code that asks for input parameters such as diameter, knurl length, and number of teeth, plus a few other things, and generates the g code as a text file. I have written code that writes data to a csv file but don't have experience with text files in Python. I know there are Pythoneers here, could anyone point me at or otherwise give an example of code that writes to a text file? I'd rather have an example to "be inspired by" (= copy!) than links to tutorial stuff, since the latter in my experience assumes Python knowledge I don't have! Thanks in advance! |
Dave S | 09/09/2021 12:59:16 |
433 forum posts 95 photos | This is microPython, rather than Python, but the file handling is the same IIRC. The code snippet (culled from that link):
Dave Edited By Dave S on 09/09/2021 13:01:19 |
blowlamp | 09/09/2021 13:44:57 |
![]() 1885 forum posts 111 photos | I tried to replicate this in CamBam and it looks like it should work OK. I drew a 45 degree line and replicated it at the correct spacing, to give a total of 42 lines. I then mirrored, copied & pasted them over the first set, to give a diamond pattern. All the lines can be engraved in one operation, by using the wrapped Rotary X post processor. Here's the gcode from CamBam, but it is very long so feel free to cut or truncate: Martin.
|
blowlamp | 09/09/2021 13:45:14 |
![]() 1885 forum posts 111 photos | Continued from above post. G0 Z8.0 Edited By blowlamp on 09/09/2021 13:46:14 |
SillyOldDuffer | 09/09/2021 15:58:42 |
10668 forum posts 2415 photos | Posted by John Haine on 09/09/2021 11:01:29:
Posted by DC31k on 06/09/2021 14:18:52:
Could I bang the drum a little for learning a programming language (e.g. Python) for this task?
... I know there are Pythoneers here, could anyone point me at or otherwise give an example of code that writes to a text file? I'd rather have an example to "be inspired by" (= copy!) than links to tutorial stuff, since the latter in my experience assumes Python knowledge I don't have! Thanks in advance! Not that it matters for small files, but Dave's example is slow because the file is opened and closed for each append. As open and close are expensive operations involving the operating system in permission checks and resource management, it's usual to open files once at the beginning and close them only at the end. My example writes 30 'hello' lines to a file once per second. It uses print() rather than write(), which I pedantically reserve for binary output. Omitting file=myFile, or setting file=sys.stdout, writes to the screen, which is useful whilst debugging. Dave |
John Haine | 09/09/2021 16:18:45 |
5563 forum posts 322 photos | Thanks Martin. The code I used from the spreadsheet, using a subroutine, is this. G00 X1 Y0 Z67.595 (Start position) One thing to try to avoid in this is long positioning rotations of the A axis which take a long time. This is avoided in my code in this case by making 360 degree rotations as part of the cut but I am aking a long knurl for demo purposes. I've realised that if one slightly constrains the problem one can make shorter knurls with no re-positioning of the rotary axis at all. The subroutine though only works as long as the controller supports them - Mach 3 does but GRBL for example doesn't, so I'd like to produce in-line code as you have which has no looping or branching. Still I think one should need only twice as many G-code lines as there are "teeth" around the knurl except for a few extras at the start and end. |
Please login to post a reply.
Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!
Sign up to our newsletter and get a free digital issue.
You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy
You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.
Click THIS LINK for full contact details.
For subscription issues please see THIS LINK.