CNC Code Shooter
How to write a CNC Lathe Program

  How to write a CNC Lathe Program basics

  1. Most machines require a % (percent ) sign on the first line. This tells the machine to start reading.
  If you are uploading with a 232 connection you can set the machine file on send and receive to add the % for you.
   If you upload via flash drive you have to add it yourself.

  2. Program number
  the first character is the letter O followed by a 4 or 5 digit number ie( O0123).

  3. On the same line after the program number you can put the Program description in parenthesis.   When you look at the list of programs on most controls it will display the whole line.
  Example program list
  O111 (A2299 op1)
  O112 (A2299 op2)
  O113 (large flange turn OD)
  O288 (2891 flange rev 4 op1)

  4. After the program description the first machining description is usually next.
  ie (rough face)
   (leave .01)
  all comments are in parenthesis

  5. Tool description
   (R.H. CNMG 542)
  Right Hand CNMG 542
  5 is size of insert
  2 is radius in 64ths
  z-radius ie 1/32

  6. Tool Change Position
  G28 U0 W0 - Machine Home Position
  U0 is x-home
  W0 is z-home
  Hass can use G28 = both axis home

  7. Tool change -
  T0101 = first 2 digits 01 = tool 1 and 2nd digits 01 = offset number

  8. Spindle gear speed change clamp
   G50 S300 M41
  Spindle Clamp Preset Spindle Speed 1st gear (most machines)
  
  9. MO3 S300 G96
  Spindle On - Forward Surface Speed use surface speed
300 feet / second

  10. Approach part
  G00 X12.2 Z2.0
  Rapid

  G00 Z.5 MO8 = Coolant on

  11. Canned Face Cycle (2 line)
  G72 W.085 R.03
  W = Z depth of cut
  R = Retract amount

  G72 P101 Q102 UOW .01 F .015
  P = Pickup # (start block)
  Q = Quit block #
  U = X stock to leave
  W = Z stock to leave
  F = Feedrate, this feedrate overrides others on this cycle

  12. N101 G00 Z 0
  Rapid to Z 0 in increments of depth of cuts

  N102 X 5.0 F .01
  Face to X 5.0

  13. G00 X15 Z5.0
  Move tool away from part
  14 (ROUGH TURN) Operation description
  (TOOL 1) Tool Number
  (R.H. CNMG 542) Tool desription

  G28 U0 W0 Home
  T0202 Index tool
  G50S300M41 preset - spindle clamp - gear change
  MO3 S300 G96 Spindle forward 300 surface speed constant surface speed
  G00 X12.2 Z2.0 position tool
  G00 Z.5 MO8 Bring Z closer coolant on
  G71 U.125 R.03 Turn canned cycle .125 depth of cut per side Retract amount
  G71 P201 Q202 U.1 W.01 F.015 Start block End Block Leave stock .1 X .01 Z Feedrate
  N201 G01 X11.0 Z.001 F.01 Toolpath Feedrate for finish pass it will ignore this feerate on the rough cycle
  G03 X11.1 Z-.05 R.05 Radius at the face of part
  G01 Z-1.5
  X11.25 Z-1.625
  N202 Z-6.03
  G00 X15. Z5.0 M09 Clear tool coolant off
  M00 Machine Stop


  (FINISH TURN) Operation description
  (TOOL 2) Tool Number
  (R.H. CNMG 542) Tool desription
  G28 U0 W0 Home
  T0202
  G50S300M41
  MO3 S320 G96
  G00 X12.2 Z2.0
  G00 Z.5 MO8
  G70 P201 Q202 Finish canned cycle start and stop blocks
  G00 X15. Z5.0 M09 Clear tool Coolant off
  M30 reset Program


  Program without comments
  O0123
  (ROUGH FACE)
  (TOOL 1)
  (LEAVE .01)
  (R.H. CNMG 542)
  G28 U0 W0
  T0101
  G50S300M41
  MO3 S300 G96
  G00 X12.2 Z2.0
  G00 Z.5 MO8
  G72 W.085 R.03
  G72 P101 Q102 U0 W.01 F.015
  N101 G00 Z0
  N102 X5.0 F.01
  G00 X15. Z5.0 M09
  M00
  (ROUGH TURN)
  (TOOL 1)
  (R.H. CNMG 542)
  G28 U0 W0
  T0202
  G50S300M41
  MO3 S300 G96
  G00 X12.2 Z2.0
  G00 Z.5 MO8
  G71 U.125 R.03
  G71 P201 Q202 U0 W.01 F .015
  N201 G01 X11.0 Z.001 F.01
  G03 X11.1 Z-.05 R.05
  G01 Z-1.5
  X11.25 Z-1.625
  N202 Z-6.03
  G00 X15. Z5.0 M09
  M00
  (FINISH TURN)
  (TOOL 2)
  (R.H. CNMG 542)
  G28 U0 W0
  T0202
  G50S300M41
  MO3 S320 G96
  G00 X12.2 Z2.0
  G00 Z.5 MO8
  G70 P201 Q202
  G00 X15. Z5.0 M09
  M30

   Please check back soon as we are still working on this page and will be updating it soon.

Home | Downloads | Linux Downloads | About | Support | cncvideos | Purchase