Programming of CNC Machining

CNC Programming

CNC is the short form for Computer Numerical control. The numerical control machine tool receiving information through a punched paper tape or floppy disk and the tape is prepared in accordance with a program manuscript written for the job or operations to be carried out on the CNC machine. The program is prepared by listing the coordinate values (X, Y, Z) of the entire tool paths as suited to machine the complete component. The coordinate values are prefixed with preparatory codes to indicate the type of movement required (straight or circular) from one coordinate to another. Also, the coordinates are suffixed with miscellaneous codes for initiating machine tool functions like start, stop, spindle movement, coolant on/off and optional stop. In addition to these coded functions, spindle speeds, feeds and the required tool numbers to perform machining in a desired sequence are also given. All these elements represent a line of information and form one meaningful command for the machine to execute and are called a block of information. The number of such blocks written sequentially forms a part program for the particular component.

Haas CNC Milling Machine Control Panels

Haas CNC Milling Machine Control Panels

What the programmer has to do?

  • Study the relevant component drawing thoroughly.
  • Identify the type of material to be machined.
  • Determine the specifications and functions of machine to be used.
  • Decide the dimension and mode- metric or inch.
  • Decide the coordinate system- absolute or incremental.
  • Identify the plane of cutting.
  • Determine the cutting parameters for the job or tool combination.
  • Decide the feed rate programming- mm/min or mm/rev.
  • Check the tooling required.
  • Establish the sequence of machining operations.

Example of CNC Milling Machine Program

Job Drawing

Job Drawing

Main Programming

  1. O0001
  2. G21 G17 G90 G40 G80 G49
  3. G45
  4. T01 D01 M06
  5. G00 Z100
  6. G00 X140 Y60
  7. G00 Z5
  8. G97 S750
  9. G94 F100
  10. M03
  11. G01 Z0
  12. M98 P00090015
  13. (M98 P0009 L15)
  14. G00 Z100
  15. M30

Sub Programming

Absolute Mode Incremental Mode
O0009 O0009
G90 G01 Z-1 G91 G01 Z-1
G42 G90 G01 X110 G42 G01 X-30
G01 Y110 G01 Y50
G01 X30 G01 X-80
G03 X10 Y90 R20 (I0 J-20) G03 X-20 Y-20 R20 (I0 J-20)
G01 Y10 G01 Y-80
G01 X30 G01 X20
G02 X70 Y10 R20 (I20 J0) G02 X40 Y0 R20 (I20 J0)
G01 X90 G01 X20
G01 X110 Y30 G01 X20 Y20
G01 Y80 G01 Y50
G01 Y140 Y60 G01 X30 Y-20
G40 G01 X140 Y60 G40 G90
M99 G01 X140 Y60
M99

Some Vital CNC Milling G Code List

G code Description
G00 Rapid Motion
G01 Linear interpolation Rapid Motion
G02 Circular interpolation Rapid Motion CW
G03 Circular interpolation Rapid Motion CCW
G04 Dwell
G10 Set Offsets
G17 X Y plane selection
G18 Z X plane selection
G19 Y Z plane selection
G20 Select Inches
G21 Select Metric
G28 Return to reference position
G31 feed until skip
G35 Automatic Tool Diameter Measurment
G36 Automatic Work Offset Measurment
G37 Automatic Tool Offset Measurment
G40 Cutter compensation cancel
G41 2D Cutter compensation left
G42 2D Cutter compensation right
G43 Tool length compensation + direction
G44 Tool length compensation – direction
G49 G43/G44 cancel
G51 Scaling
G53 Machine coordinate system selection
G54 Workpiece coordinate system 1 selection
G55 Workpiece coordinate system 2 selection
G68 Rotation
G73 High Speed Peck drilling cycle
G76 Fine boring cycle
G80 Canned cycle cancel
G81 Drilling cycle
G82 Stop Drilling Canned boring cycle
G83 Peck drilling cycle
G84 Tapping cycle
G85 Boring cycle
G90 Absolute command
G91 Increment command
G92 Setting for work coordinate system or clamp at maximum spindle speed
G98 Return to initial point
G99 Return to R point in canned cycle

Some Vital CNC Milling M Code List

M code Description
M00 Program stop
M01 Optional program stop
M02 End of program
M03 Spindle start forward CW
M04 Spindle start reverse CCW
M05 Spindle stop
M06 Tool change
M08 Coolant ON – Flood coolant
M09 Coolant OFF
M19 Spindle orientation
M30 End of program (Reset)
M41 Low gear Override
M42 High gear Override
M94 Cancel mirrorimage
M95 Mirrorimage of X axis
M96 Mirrorimage of Y axis
M98 Subprogram call
M99 End of subprogram

Add a Comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.