Catlogue Icon Whatsapp Icon Telephone Icon
cad-mech-logo
Email mktg@cadmech.co.in
Call +91 8380001463
Whatsapp +91 97637 19531
Worlddiadic Member Basic Logo
ISO Logo

G-CODE Book: The Essential Resource for CNC Machinists


CNC Machine 0 Comments 2 July

WHAT IS CNC ?

CNC stands for Computer Numerical Control. It's a technology that utilizes computers to control machine tools and automated manufacturing processes. This allows for precise and efficient production of complex parts and components. CNC machines operate based on programmed instructions (G-code).

WHY CNC REQUIRED ?

CNC (Computer Numerical Control) is required in manufacturing for several key reasons:

  • 1. Precision and Accuracy
  • 2. Complexity
  • 3. Repeatability
  • 4. Automation
  • 5. Flexibility
  • 6. Cost-effectiveness
  • 7. Safety
Overall, CNC technology is essential for modern manufacturing to meet the demands of quality, efficiency in producing a wide range of products across various industries.

WHAT IS G-CODE ?

G-code is a standardized programming language used to control computer numerical control ( CNC ) machines. It consists of a series of alphanumeric codes that instruct the machine. Some machines with proprietary formats can also run g-code. It is the working language of CNC.

WHY LEARN G-CODE ?

Every CNC operator/programmer should know g-code. For following reasons –

1. G-CODE allows you to precisely control cnc machines. This control is essential for creating complex parts and achieving high-quality finishes.

2. G-CODE is used across various cnc machines. Mastering g-code gives you the ability to work with different types of cnc equipment.

3.G-CODE allows for customization of machining operations.

4. proficiency in G-CODE programming enhances your employability in industries.

5. G-CODE proficiency opens doors to exploring advanced manufacturing techniques.

THE CO-ORDINATE SYSTEM

Hold up your right hand with the index finger extended and the thumb up, like you're simulating a gun. Now extend your second finger at right angles to the index finger. Those three fingers are now pointing in the directions of positive X (second finger), Y (index finger) and Z (thumb). That's why we say CNC uses a Right Handed Coordinate System.




Each machine will have its own specific axis orientation. Here are some common types:



Lathe Axes For a Typical CNC Turning Center



5 Axes Mill with Trunion Table



Mill Axes For a Typical Vertical Machining Center

DESIGNATION OF MACHINE AXES –





EXPRESSING COORDINATES IN G-CODE

In G-code, coordinates are typically expressed using absolute or relative positioning depending on the command. How coordinates are expressed:

Absolute Coordinates

Absolute coordinates specify the exact position relative to the machine's reference point.

For example, to move to a point where:

  • X coordinate is 100,
  • Y coordinate is 50,
  • Z coordinate is 10,

G01 X100 Y50 Z10

Relative Or Incremental Coordinates

Relative coordinates specify movement relative to the current position.

For example, to move 10 units in the X-axis, 5 units in the Y-axis, and -2 units in the Z-axis from the current position, y

G01 X10 Y5 Z-2

Incremental and Absolute Modes

  • Incremental mode: Coordinates are relative to the current position.
  • Absolute mode: Coordinates are absolute from the machine's origin.

The mode can be set using G90 (absolute mode) or G91 (incremental mode).

Tips

  • Always ensure your G-code program starts with setting the appropriate mode (G90 for absolute, G91 for incremental) to avoid unexpected behavior.
  • Check the documentation for your specific CNC machine can vary slightly between different implementations of G-code.

WHAT ABOUT UNITS—METRIC OR IMPERIAL?

In G-code, the choice between metric (mm) and imperial (inches) units depends on the machine's configuration and the G-code program.

Metric Units (mm)

G20 Mode: Metric units are typically denoted in millimeters (mm).

Example: G21 Set units to millimeters (metric)
G01 X50 Y30 Z5
Move to absolute position X=50mm, Y=30mm, Z=5mm

Imperial Units (Inches)

G21 Mode: Imperial units are denoted in inches.

Example: G20 ; Set units to inches (imperial)
G01 X2.0 Y1.5 Z0.25
Move to absolute position X=2.0 inches, Y=1.5 inches, Z=0.25 inches

TOOL OFFSET

In manufacturing and machining contexts, "tool offset" refers to a crucial parameter used in CNC machining operations.

Tool Offset in CNC Machining:

  • 1. Definition: Tool offset refers to the deviation or difference in dimensions between the theoretical position of a cutting tool and its actual position when mounted in the machine spindle. This discrepancy can arise due to various factors such as tool wear, tool length variations, or calibration inaccuracies.
  • 2. Setting Tool Offsets: Operators typically set tool offsets through the machine’s control panel or software interface. This involves measuring the tool dimensions accurately using specialized tools or gauges and inputting these dimensions into the machine’s memory.

For X axis Offset –

Hold workpiece in spindle & touch Tool to OD.By Vernier measure diameter of the workpiece, for example 30 mm.Then , go to Tool offset, take cursor to as per “X”tool number , then press X30.0 “Measure”.



CNC LATHE G-CODE REFERANCES -

CODE CODE DESCRIPTION
G00 RAPID TRAVERSE
G01 LINEAR INTERPOLATION
G02 CIRCULAR INTERPOLATION CLOCKWISE
G03 CIRCULAR INTERPOLATION COUNTERCLOCKWISE

G04

DWELL IN SECONDS
( F ) - for axis         S - SPINDLE ROTATION
G06 PARABOLIC INTERPOLATION
G07 ELLIPTICAL INTERPOLATION CW
G08 ELLIPTICAL INTERPOLATION CCW
G22 SUBROUTINE CALL
G28 START OF DO LOOP
G29 END OF DO LOOP
G32 THREAD CUTTING
G77 CANNED CYCLE FOR TURNING
G81 PECK DRILLING CYCLE
G90 ABSOLUTE PROGRAMMING MODE
G91 INCREMENT PROGRAMMING MODE
G93 PARTING/GROOVING CYCLE
G94 CANNED CYCLE FOR FACING
G96 CONSTANT SURFACE SPEED ENABLE
G97 CONSTANT SURFACE SPEED DISABLE


CNC LATHE M-CODE REFERANCES –

CODE CADMECH CODE DESCRIPTION
M01 PROGRAMME STOP, CONDITIONAL
M02 MAIN PROGRAMME END
M03 SPINDLE ON CLOCKWISE
M05 SPINDLE OFF
M08 COOLANT ON
M09 COOLANT OFF
M10 CHUCK CLAMP
M11 CHUCK DECLAMP
M30 MAIN PROGRAMME END
M41 HIGH GEAR SELECT


AUXILIRY COMMAND –

ADDRESS FUNCTION DESCRIPTION
N Block Number Block Numbers are used for search both manually and automatically
G G Code Machine control function. For a full list of G Codes refer to the G Code list page
M M Code Auxiliary machine control function. For a full list of M Codes refer to the M Code list page
X, Y, Z, U, V, W Coordinates Axis positional commands using the Cartesian coordinate system
R Radial Coordinates Defines the radius for corners and arcs
I, J, K Centre point Coordinates Defines the centre point of arcs and radius
S Spindle Speed Defines the spindle speed in RPM or if in surface speed mode the feet per min of surface of material
F Feed Rate Defines the motion speed of the tool
T Tool Defines the tool number and offset number is default. i.e. T01
I, K, P, Q, R Cycle Definition Refer to the section on cycles for uses.

PROGRAM BLOCK -

N G X—Y-- F S T M
---------- ---------- ---------- ---------- ---------- ---------- ----------
SEQUNCE NO. PREPARATORY FUNCTION DIMENSION WORD FEED FUNCTION SPINDLE SPEED FUNCTION TOOL FUNCTION AUXILIRY FUNCTION


CNC MILLING G-CODE REFERANCES –

CODE CODE DESCRIPTION
G00 RAID TRAVERSE
G01 LINEAR INTERPOLATION
G02 CIRCULAR INTERPOLATION CLOCKWISE
G03 CIRCULAR INTERPOLATION COUNTERCLOCKWISE

G04

DWELL IN SECONDS
( F ) - for axis         S - SPINDLE ROTATION
G17 PLANE SELECTION X-Y
G18 PLANE SELECTION X-Z
G19 PLANE SELECTION Y-Z
G22 SUBROUTINE CALL
G28 START OF DO LOOP
G29 END OF DO LOOP
G50 MIRROR OFF
G51 MIRROR ON
G70 INCH PROGRAMMING
G71 METRIC PROGRAMMING
G72 P.C.D. HOLE DRILLING CYCLE
G73 HIGH SPEED PECK DRILLING (DEEP HOLE DRILLING)
G76 RECTANGULAR POCKETING
G77 CIRCULAR POCKETING
G81 NORMAL DRILLING CYCLE
G82 DRILLING / COUNTER BORING WITH DWELL
G85 BORING CYCLE
G86 BORING CYCLE WITH DWELL
G90 ABSOLUTE PROGRAMMING MODE
G91 INCREMENT PROGRAMMING MODE

CNC MILLING M-CODE REFERANCES –

CODE CODE DESCRIPTION
M02 MAIN PROGRAMME END
M03 SPINDLE ON CLOCKWISE
M05 SPINDLE OFF
M08 COOLANT ON
M09 COOLANT OFF
M10 JOB CLAMP
M11 JOB UNCLAMP
M14 DOOR CLOSE
M15 DOOR OPEN
M30 MAIN PROGRAMME END

0 Comments

  • No comments yet.

Write a comment