A couple of places on the web list G and M codes as a reference; one can be found here: http://www.machinetoolhelp.com/Appli...G-M-codes.html
Learning how to use these codes isn't very difficult in itself. Machines can be different though, so I strongly suggest patience and plenty of scrap material. Basically, you begin with the code "command" and follow with coordinates.
The code "G20" should set you to inch units, and "G21" to metric. Assuming you're set up for inch units on the machine and to absolute coordinates:
----------------------
Example:
G00 Z1.000
The G00 indicates a rapid move to the absolute position where Z = 1.000inches.
----------------------
Example: a rapid move (not doing any cutting, but just getting from point A to point B quickly) can be entered as:
G00 X0.500 Y0.800
The G00 indicates a rapid move to the absolute position where X = 0.5 and Y = 0.800 inches.
----------------
Example:
G01 X0.500 Y1.606 F2.5
The G01 specifies a linear feed from your current position to the absolute coordinates of X = 0.500 and Y = 1.606, with a feed rate of 2.5 units/minute.
--------------
Example:
G04 #12
The G04 indicates a pause is needed for 12 ("#12") seconds. For safety concerns, never use this pause to change out tools or otherwise stick your fingers near the machine. It's only human to get your fingers in the wrong place at the wrong time, and it's only machine-like for the mill to not care and maul them anyway.
For a definite hold in the cycle, use M00 (hold until key is pressed) or M06 (the wait-for-tool-change) codes instead.
--------------
Example:
G81 X1.000 Y2.000 Z-1.500 F2.25 R0.500
(Assumes absolute coordinates and inch units used for this example)
G81 indicates a drill cycle, which is what I think you're looking for in your project as well. The X and Y indicate where the hole will be drilled. But, if the tool is currently positioned below the release plane (R0.500) at absolute 0.5 inches, the Z axis will be moved to 0.5 first. Safety consideration.
The hole will be drilled down to the absolute position of -1.5 inches (Z-1.500); note the negative sign.
It's a good idea as habit to put G80 on the next line, which clears the drill cycle from the memory.
---------------
Example:
G28
Return to "home" coordinates (0, 0, 0).
---------------
Example:
M02
End of program... this is the last line in your code.
So, a quick program using some of the examples above:
G20
G90
M00
G00 Z0.500
G00 X0.626 Y1.125
M08
G04 #2
G01 Z-0.250 F1.2
G01 X2.000 Y1.125 F2.2
G01 Z0.005
M09
G00 Z0.500
M02
This isn't the most efficient way of doing it, but just wanted to illustrate an easy-to-see example. At first, inch units and absolute coordinates are specified using the G20 and G90 codes. The, the machine waits for you to press a key to begin from the M00 code, and when received, it rapidly moves the Z axis to absolute 0.5 inches. It moves quickly to coordinates (0.626, 1.125 inches), then turns on the flood coolant. The machine pauses for 2 seconds. The operation is then set for a feed rate of 1.2 ipm, drilling to an absolute depth of -0.25 inches. Since the Z is not raised in the next line of code, you are milling a slot from your current position and depth to coodinates (2.000, 1.125) at a new feed rate of 2.2 ipm. The tool is raised to just above the part (in this case, the top of the part was Z=0.000) and the coolant turned off. The tool was then quickly raised to 0.500 inches (absolute) to clear the part a good amount more.
Everyone's machine is different though, and the code listed above is not necessarily the most efficent way to do things nor encompasses all the setting to be made. Just illustrative.
Hope it helps answer your questions a bit.


LinkBack URL
About LinkBacks






