G Code with a Mill

Hi-

Our mill has arrived, but before we start to use it, I figured id try and learn the code for it.

I was able to make some cool triangle things in the software for the mill (MillMaster Pro for Windows - CNC Milling software for Mills and Torch Machines.), but I am having a HUGE difficulty with circles.

I have been trying for about 2 days, searched Google, and CD, but the program is always giving me a straight line, or a very sharp curve…

I am trying to learn to make simple circles, or even half circles.
I attached a photo with what is going on, any help is appreciated?
(The green is what the software is doing, the red is a crude sketch of what I want to happen)

And the code…(and what I think it should do?)
G90 //Set it to absolute mode, X+Y begin at 0, Z at 1.

G01 X5 Y5 //Put to center of circle, 5,5
G01 X1 Y5 //Go to starting point of circle, 4 away from center.
G01 Z-1 //lower the cutter
G02 X9 Y5 I5 J5 //Should make a semi-circle going out to 9,5 with a center of 5,5?

Note: In case someone says it… No, I am NOT doing this on any material, only the software, so I’m not breaking things. :stuck_out_tongue:





First, welcome to the world of CNC! It is SO much fun. There are a few problems in your code; let me try to help.

There is no need to move to the center of the circle before making the circular interpolation. The line that reads “G01 X5 Y5 //Put to center of circle, 5,5” can be eliminated.

Your next line to position the machine at the start of the arc is fine, however usually this would be a “rapid” G0 (or G00) move through air rather than a G01 “feed” move that is usually used for cutting the material.

Your G02 (clockwise circular interpolation) line should read:

G02 X9. Y5. I4. J0

The I and J coordinates are the incremental distances from the starting point to the center of the arc, not the coordinates of the center itself. The coordinates of the center itself never actually appear in the code. So if you are starting at 1,5 the center (at 5,5) is located at an incremental/additional 4 in the X (I), and 0 in the Y (J) directions (since you are sitting directly to the left of your intended center).

The code revised as listed above will yield a semi-circle (half circle). If you wanted a full circle, you would leave out the X and Y coordinates, and the end point would be the same as the start point, resulting in a full circle.

Also, not sure about yours, but many machines are very particular about leaving decimal points off of a number. For example, on a HAAS machine, “F4” does not mean the same thing as “F4.” Oh, and that’s the the other thing. You are missing feed rates all around. The units of feed rates are in inches per minute. To start out, I’d keep the feeds under 10 IPM.

Also, in your first line (the G90 absolute line) I would add G0 X0 Y0 Z1 to make it do what you say in the comment.

Finally, many CAM programs such as MasterCAM really make coding for the CNC a piece of cake. You should investigate these.

If you wish to improve your understanding of G-code and the machine’s interpretation of it, you will find this manual very helpful: http://coestudentshop.engr.wisc.edu/Info_PDFs/MillWorkbook.pdf

Thanks!

I was actually talking with chris L, and he was helping me out!

Thanks for your post also, it also clears things up.
So if I am going to use I and J (which chris has taught me how to use R, seems easier) I need to do incremental mode?

Is there a way to change that in the settings of the program? It know the program (And machine itself) I use in my CIM class does not work via increments. So to me his code was just fine. Had he plugged it into the program in my class it would have worked.

Do you have any idea as to what would cause this?

Also. The feed rates depend entirely on what you are cutting. I cut butter board around F15 and plunge at F5 just to be safe. I could probably cut faster. But as a side note. Just as with driving you slow down for turns. Slow your feed rate down when you are cutting arcs.

-Rion

No idea. The standard way G-code is interpreted is how I wrote above. Some manufacturers of machine controllers may choose to differ.

Also, it should be noted that an “R” word in the G02 line is not capable of producing a 360 degree arc. For a full circle, I and J coordinates must be used.

To clarify, here is an excerpt from the Haas user manual. Note that this is not Haas specific-any Fanuc based controller will follow these same rules. I am certain that his code would not run correctly on your program, as I and J are always incremental distances to the arc’s center.

Using I, J, K addresses
I, J and K address are used to locate the arc center in relation to the start point. In other words, the I, J, K
addresses are the distances from the starting point to the center of the circle. Only the I, J or K specific to the
selected plane are allowed (G17 uses IJ, G18 uses IK and G19 uses JK). The X, Y, and Z commands specify
the end point of the arc. If the X, Y, or Z location for the selected plane is not specified, the endpoint of the arc
is the same as the starting point for that axis.
To cut a full circle the I, J, K addresses must be used; using an R address will not work. To cut a full circle, do
not specify an ending point (X, Y and Z); program I, J or K to define the center of the circle. For example: G02
I3.0 J4.0 (Assumes G17; XY plane)

The Haas user manual is a great resource for manual programming. Even though it’s put out by Haas, it gives specific examples and sample programs. Like I said earlier, any Fanuc based control will use the same formatting (or very, very similar) as the Haas for all basic g-codes (G00/G01/G02/G03, G43, G41/G42). It’s particularly useful for examples involving cutter compensation.

It can be found here: http://www.haascnc.com/pdf/96-8000.pdf

You said that his program would most likely not work on mine. But the way I have been writing programs says that it would.

Here is a program I have written the does indeed work.

;Rion Atkinson
;12-1-09
;Ornament Project
G90 M03 S250 ; Turn on spindle
G00 X0 Y0 Z1 ; Move to starting point
G00 X1.0 Y0.3 ; Move rapid above point A
G01 Z-0.125 F5 ; Plunge to point A
G01 X0.9 Y0.5 F20 ; Cut to point B
G01 X1.9 Y1.4 ; Cut to point C
G02 X2.3 Y0.6 I2.1 J1.0 ; Cut Clockwise to point D
G01 X2.2 Y0.8 ; Cut to point E
G03 X2.0 Y1.2 I2.1 J1.0 ; Cut Counter-Clockwise to point F
G01 X1.0 Y0.3 ; Cut to point A
G01 Z1 ; Move up out of material
G00 X2.0 Y0.3 ; Move rapid above point G
G01 Z-0.125 F5 ; Plunge to point G
G01 X2.1 Y0.5 F20 ; Cut to point H
G01 X1.1 Y1.4 ; Cut to Point I
G03 X0.7 Y0.6 I0.9 J1.0 ; Cut CC to point J
G01 X0.8 Y0.8 ; Cut to point G
G01 Z1 ; Raise up out of material
G00 X1.5 Y1.2 ; Move rapid above point M
G01 Z-0.125 F5 ; Plunge into material
G02 X1.5 Y1.2 I1.5 J1.55 ; Cut Clockwise to point M
G01 Z1 ; Raise up out of material
G00 X2.3 Y1.4 ; Move rapid above point N
G01 Z-0.125 F5 ; Plunge into material
G03 X2.3 Y1.4 I2.5 J1.6 F20 ; Cut CC to point N
G01 Z1 ; Raise up out of material
G00 X0.8 Y1.5 ; Move Above point O
G01 Z-0.125 F5 ; Plunge to point O
G02 X0.8 Y1.5 I0.6 J1.6 ; Cut Clockwise to point O
G01 Z1 ; Raise out of material
G00 X2 Y5 ; Move rapid to off loading point

(Sorry for no line numbers. I had to write this out of a piece of paper so I left them out.

It cut this out of butter board.

http://picasaweb.google.com/lh/photo/wGiU3O6eYxreYQ9XblVyjg?feat=directlink

I got bored, so I decided to write this up, hopefully once our mill gets working, I can try it on a wax block.
http://img707.imageshack.us/img707/3061/diamonds.jpg

You can’t see it in the picture, but the cuts are different depths…The inner-most circle is the highest, and then each one outside it descends by .25". :smiley:

I have a quick question about it, will the cuts be too close, and overlap each other?

That depends. What is the width of the bit that you plan to use to cut this?

I’m not sure what size we have. I used the smallest one the software had, which is 0.1000"

Ok. Well. If that is the width of the bit you can use then the picture shows exactly how it will turn out.

If the lines are more than 0.100 apart, you’ll end up with grooves and not a surface.

One might use a 0.250 bit, separate the lines by .250 (maybe .249) and drop down .250.

Just remember that you need to consider what the bit can cut: At that outermost line, you’ve dropped down by an inch, right? Can your bit cut a whole inch at a time? If not, how might you address that issue?

This is one reason it is often better to learn how to use a manual mill before getting into a CNC mill. Understanding the milling process is critical.

Look at the following site. http://www.machsupport.com/

Their wizards are very helpful for standard routines. They may offer a break to FIRST teams.
This is the control package team 1189 uses. Our CAD program, Key Creator includes a built in NC function that creates cutter paths and posts them to a wide choice of post processors.

This (free) software may be helpful. It doesn’t have a lot of features, but is very simple to use, so you can try it with different-sized endmills… http://www.cncsimulator.com/

Cheers,
-Neil.