Chipper5783
Super User
That's fascinating. For full disclosure I am a CAM newbie (kindergarten level) so the idea of writing the G-code for something other than a straight line move is beyond me.
I'd be very interested in seeing an example of a 2D shape you've milled and its corresponding G-code.
I'll share the example of the scroll teeth on the back of 3J chuck jaws. Understanding the details of math and what those teeth are accomplishing is a project all in itself (at least it was for me). Obviously one has to sort that out first - I don't see CNC as magic, you still have to know what you want and be able to describe it. The approach is well written up by Harold Hall (Google his site, he has lots of interesting projects and ideas http://www.homews.co.uk/page99a.html ).
Here is the G code that I used. I have edited out most of the embedded comments (I put a lot of comments in to explain to myself what I am doing, if I do this job again, I'll have long forgotten what I did or was thinking). The actual operation is repeated 8 times, so I have also edited out the repeats (it is simply the same call over and over again). I did this project ~5 years ago, were I to do it again I would do it differently (thinking that I have learned a few things since then) - the basic function of helical interpolation would be the same. For example I would make greater use of variables instead of editing numbers all the way down for each jaw.
In summary, the tooth shape is generated by operations called in the macros (#1 for roughing, #2 for finishing. I think it was the same type of tool, but I used a new end mill just to do a final little clean up). Then for each tooth I am shifting the referenced origin by 1/3rd of the face scroll pitch - in this case I was actually editing the G97 line ("Translation") depending on what jaw I was making (1, 2 or 3). Obviously there would be a number of approaches (you could make the jaws all exactly the same and then cut them off later - since they get trimmed anyway when setting them up on the chuck.
You can appreciate that to make this work, like any machining project, what I am sharing here is only one step - cutting the teeth into the jaw blanks. Setting the part position (machine origin), also machining all the other features of the jaws (I chose to make them as two piece jaws, but I really doubt I'll have separate the tops and the master - the whole jaw is a soft jaw and I made two sets - but that is okay, I could separate them if I felt like it some day), and setting the jaws up in the actual 3J chuck (how to put load on the jaws, trimming the ID/OD etc) - those are all separate topics or projects themselves.
Anyway, to answer your question, here is the code to cut the scroll teeth. To summarize, I am putting the tool into a starting position, then cut G13, then reposition the tool, then cut G12 - repeat. The real content is only 4 lines of code.
#1 ; Set up part program to rough cut both surfaces of each tooth. Origin backed up 0.0025
G1 R3.2778 I0.0 J0.0 A340.0 Z-0.180 F10.0 ; Positioning.
G13 R3.2222 A40.0 F1.4 ; To cut slot change to F0.5
G1 R4.6702 I-1.4385 J0.0 A15.0 Z-0.180 F10.0 ; Positioning.
G12 R4.7118 A30.0 F3.0 ; Change to F0.5 to clean up slot
$ ;
#2 ; Now finish both sides and the bottom. Climb milling
G1 R4.7118 I-1.4335 J0.0 A345.0 Z-0.193 F10.0 ; Positioning
G13 R4.6702 A30.0 F5.0 ;
G1 R3.2222 I0.0 J0.0 A20.0 F10.0 ; Positioning
G12 R3.2778 A40.0 F5.0 ;
$ ;
N200 T2 M6;
G90 G0 X3.1 Y-1.0 Z0.1 S2200 M3; Rapid to near the origin point
G97 X-0.1642; Translate for a rough cut #1, 0.0025 or 0.1692 or -0.1642
; leave 0.0025" to skim on each side of the slot.
=#1 ; Cut the first groove
G97 X0.3358; Translate for a rough cut #2, 0.5025, 0.6692 or 0.3358
=#1 ; Cut the second groove
.
.
.
; Change tool for the finishing cuts - now climb mill, both sides 0.0025"
; Add 0.1667", then -0.1667" for the next two jaws.
N300 T3 M6 ; Change tool
G90 G0 X3.1 Y-1.1 Z0.5 S2590 M3 ; Restart
G97 X-0.1667 ; Translate for finish cuts,0.0 or +-0.1667
=#2 ; Clean up the first groove
G97 X0.3333; Translate for a finish cut, 0.5, 0.6667 or 0.3333
=#2 ; Cut the second groove
G97 X0.8333; Translate for a finish cut, 1.0, 1.1667 or 0.8333
=#2 ; Cut the 3rd groove
.
.
.
M02; Program end
Attachments
Last edited by a moderator: