CNC

Creating a CNC Turning Program 301

Creating a CNC Turning Program illustrates the process of creating a part program for a CNC lathe. Part programmers use G code programming to perform the different tasks within a part program, from describing the location of a cutting tool to setting the feed and speed. Canned cycles help to shorten the length of part programs.

A part programmer needs a thorough understanding of G code programming and how it relates to the axes on a CNC lathe to create a part program that produces accurate parts. After taking this class, users should be able to describe how to write a part program that machines a basic cylindrical part on the CNC lathe.

  • Difficulty Advanced

  • Format Online

  • Number of Lessons 22

  • Language English

TO GET STARTED SPEAK WITH A SPECIALIST AT 1.866.706.8665

Or fill out this form and a specialist will contact you shortly

Course Outline
  • Part Program
  • Creating a Part Program
  • Toolpaths
  • Modes of Motion
  • Modes of Motion G Codes
  • Part Program Creation
  • Programming Tool Movements
  • Startup G Codes
  • Startup Codes
  • Speed and Feed Modes
  • Using a Template
  • Categorizing G Codes
  • Facing
  • Rough Turning
  • The Rough Turn Canned Cycle
  • The Drilling Path
  • The Peck Drill Canned Cycle
  • The Boring Path
  • The Finish Turn Path
  • A Completed CNC Lathe Part Program
  • Avoiding Error
  • Program Blocks
Objectives
  • Describe the role of a part program.
  • Identify the major steps necessary before the creation of a part program.
  • Describe a toolpath.
  • Identify the codes used to determine the mode of tool movement.
  • Identify the codes used to determine the mode of tool movement.
  • Describe how program codes translate into tool movement.
  • Identify common codes located at the beginning of a toolpath.
  • Identify common codes located at the beginning of a toolpath.
  • Distinguish between the two feed modes and two speed modes.
  • Identify the role of the repeating codes throughout a program.
  • Explain how to program facing and rough turning operations using G code programming.
  • Explain how to program facing and rough turning operations using G code programming.
  • Describe the operation of the rough turn canned cycle.
  • Identify the setup parameters of a drilling sequence.
  • Explain the parameters of a peck drilling canned cycle.
  • Identify the parameters of a boring operation.
  • Describe the operation of the finish turn canned cycle.
  • Define the purpose of proving out.
Glossary
Vocabulary Term
Definition

absolute coordinates

A series of numerical positions that are calculated from a fixed point of origin. Absolute coordinates are the most conventional and commonly used.

axes

An imaginary straight line or circle used to describe the location or movement of an object in three-dimensional space. Three axes make up the Cartesian coordinate system: the X axis, Y axis, and Z axis.

blocks

A single line of a part program. A block is composed of words.

boring

The process of enlarging or smoothing an existing hole with a single-point tool. Boring is an inner diameter operation.

canned cycle

A predetermined machining sequence used to simplify programming. A canned cycle sequence is initiated by a single G code.

Cartesian coordinate system

A numerical system that describes the location of an object by expressing its distance from a fixed position along three perpendicular linear axes, the X axis, Y axis, and Z axis. The Cartesian coordinate system is used to program machining positions on a CNC machine.

centerline

An imaginery line that runs through the center of a cylindrical object or divides a shape into two equal halves. A cylindrical part rotates around its centerline.

chamfers

A lathe cutting operation that creates an angled edge around the end of a cylindrical workpiece or the entrance of a hole. Chamfering can be an inner or outer diameter operation.

circular interpolation

The movement of a machine tool along more than one axis at once to create curved tool motions. Circular interpolation requires an endpoint, a feed rate, a center, a radius, and a direction of movement.

CNC lathe

A machine tool that uses computer numerical data to control cutting operations on cylindrical workpieces. On a CNC lathe, the cutting tool moves against the rotating workpiece.

CNC mill

A machine tool that uses computer numerical data to control cutting operations on flat, square, or rectangular workpieces. On a CNC mill, the cutting tool rotates against a workpiece that is fixed to a worktable.

codes

The pairing of an address letter and a numerical value in a part program. Codes, also known as words, combine to make up a program block.

computer numerical control

CNC. A self-contained system of computers and precision motors that executes program instructions to guide machine tool components and manufacture parts. Lathes often operate using computer numerical control.

computer-aided design

CAD. The use of computers for the design and drawing of a part or other product. Drawings on CAD are automated and precise.

computer-aided manufacturing

CAM. The use of computer software that facilitates the development of part programs. These software applications create an image of the workpiece and develop the program code from information that the programmer inputs.

constant surface speed

CSS. A mode on a CNC lathe that increases spindle rpm as the tool approaches the centerline to maintain a constant cutting speed. Constant surface speed is measured in surface feet per minute (sfm) or meters per minute (m/min).

coolant

Any fluid used to cool, lubricate, and clear chips during metal cutting. Coolant use during a CNC cutting operation is controlled by a part program.

CSS

Constant surface speed. A mode on a CNC lathe that increases spindle rpm as the tool approaches the centerline to maintain a constant cutting speed. CSS is measured in surface feet per minute (sfm) or meters per minute (m/min).

CSS

constant surface speed. A mode on a CNC lathe that increases spindle rpm as the tool approaches the centerline to maintain a constant cutting speed. CSS is measured in surface feet per minute (sfm).

cycle start

The control button used to begin a program or continue a program that has been previously stopped. The cycle start button must be pressed to continue the progress of a part program after an optional stop.

cylindrical

A solid geometric figure with two end faces that are parallel circles whose diameters are connected by a perpendicular plane. Cylindrical parts are machined using CNC lathes.

D code

A G code programming word that often indicates the depth of cut. A D code will be in inches or millimeters, depending on whether the program uses the English or metric system.

depth of cut

The distance that a cutting tool penetrates the surface of a workpiece. Depth of cut determines the amount of material removed with each cutting pass.

direct spindle speed

A mode on a CNC lathe that retains a constant spindle rotation speed. Direct spindle speed is measured in revolutions per minute (rpm).

drill

A metal cutting tool used to penetrate the surface of a workpiece and make a round hole equal to the drill diameter. Drills can be powered by a small motor in the turret.

drilling

The use of a multipoint tool to machine a new round hole into the surface of a workpiece. Drilling creates an inner diameter in a part.

dry run

A preliminary operation to ensure that a part program will machine workpieces properly. A dry run is performed without any parts or coolant.

English

A standard system of measurements based on the inch, pound, and degrees Fahrenheit. The English System is known as the U.S. Customary System in the United States.

F code

A word in a part program that determines the feed rate during a cutting operation. F codes are usually given in inches per minute (ipm), millimeters per minute (mm/min), inches per revolution (ipr), or millimeters per revolution (mm/rev).

face

The flat, circular end of a cylindrical part. A part's face is machined during facing and turning operations.

facing

A lathe cutting operation that feeds a cutting tool across an end of a cylindrical workpiece to create a flat surface and shorten its length. Facing is an outer diameter operation.

feed

The rate at which the cutting tool moves down the length of the workpiece on a lathe. Feed is typically a linear movement.

finish

A metal cutting process that emphasizes tight tolerances and smooth surface finish. Finishing operations often require faster speeds and a lighter depth of cut.

G code

A word in a part program that determines the type of operation performed on the CNC machine. G codes apply to all blocks following their occurrence until a new G code occurs in the part program.

G code programming

A programming language that pairs address letters with numerical values to form commands. G code programming is used to direct CNC machine movements.

G00

A G code that signals rapid positioning. G00 is a mode and remains active until discontinued or replaced by another G code.

G01

A G code that signals linear interpolation. G01 performs all linear cutting operations.

G02

A G code that signals clockwise circular interpolation. G02 moves tools along a curved cutting path.

G03

A G code that signals counterclockwise circular interpolation. G03 move tools along a curved cutting path.

G50

A code in G code programming that sets the maximum spindle speed. G50 should be followed by an S code that indicates what the maximum spindle speed will be.

G70

A code in G code programming that generally activates the finish turning or facing canned cycle. The G70 canned cycle references the program blocks used in a previous rough turn canned cycle using a P code to note the starting block and a Q code to note the ending block.

G71

A code in G code programming that generally activates the rough turning canned cycle. The G71 canned cycle requires a P code, Q code, U code, W code, D code, and F code.

G83

A code in G code programming that generally activates the standard peck drilling canned cycle. During the G83 canned cycle, the cutting tool moves rapidly out of the hole between pecks.

G96

A code in G code programming that sets the speed to constant surface speed mode. G96 indicates that speed should be measured in surface feet per minute (sfm).

G97

A code in G code programming that sets the speed to direct spindle speed mode. G97 indicates that speed should be measured in revolutions per minute (rpm).

G99

A code in G code programming that sets the feed to ipr/mm/rev mode. G99 indicates that feed should be measured in inches per revolution (ipr) or millimeters per revolution (mm/rev), depending on whether the part program is coded for the English or metric system.

geometry offset

A cutter compensation that adjusts a part program for tool length. Each tool requires its own geometry offset.

holemaking

The act of machining a hole into the interior surface of a workpiece. Holemaking can be accomplished by drilling, boring, reaming, and tapping.

inches per minute

ipm. The distance in inches that the entire tool advances in one minute. Inches per minute is a measurement for feed of a cutting tool on the lathe.

inches per revolution

ipr. The distance in inches that the tool advances during one complete revolution of the workpiece. Inches per revolution is a measurement for feed on the lathe.

incremental coordinates

A series of numerical positions that use each current position as the point of origin for the next position. Due to their potential for error, incremental coordinates are less commonly used than absolute coordinates.

indexing

Changing a machine component to a different turret position. Indexing tools is signaled by T codes in a G code part program.

inner diameter

ID. The interior surface of a part. Inner diameter cutting operations include drilling, reaming, and boring.

insert

A replaceable cutting tool with a geometric shape that has multiple cutting surfaces and is mechanically held in a toolholder. Inserts can be indexed to present a new cutting edge.

ipr

inches per revolution. The distance in inches that the tool advances during one complete revolution of the workpiece. Ipr is a measurement for feed on the lathe.

linear interpolation

The movement of a machine tool along more than one axis at once. Linear interpolation requires an endpoint and a feed rate.

M codes

A word in a part program used to signal an action from a miscellaneous group of commands. M codes change cutting tools and turn on or turn off coolant, spindle, or workpiece clamps, among other actions.

M06

An M code in G code programming that signals a tool change. M06 must signal a tool change in the part programs of certain machine control unit models.

machine control unit

MCU. A small, powerful computer that controls a CNC machine. Machine control units run through a part program and convert the words into the actions that machine a part.

MCU

machine control unit. A small, powerful computer that controls a CNC machine. MCUs run through a part program and convert the words into the actions that machine a part.

meters per minute

m/min. The distance, in meters, that the cutting surface and workpiece move past one another at the point of contact in one minute. Meters per minute is also sometimes referred to as surface meters per minute (smm).

metric

An internationally recognized standard system of measurements based on the meter, kilogram, and degrees Celsius. The metric system is also known as the International System of Units.

millimeters per minute

mm/min. A unit of measurement that indicates how far in millimeters a tool advances in one minute. Millimeters per minute is used to measure feed.

millimeters per revolution

mm/rev. A unit of measurement that indicates how far in millimeters a tool advances in one rotation. Millimeters per revolution is used to measure feed.

mode

A programmed function that stays in effect until it is either cancelled or substituted with another function. The modes of motion for a CNC machine include rapid positioning, linear interpolation, and circular interpolation.

N code

A word that acts as the name or title for a program block. N codes usually occur in increments of 10.

nose radius compensation

An offset feature used on a turning center that slightly shifts the toolpath for the rounded tip of an insert. Nose radius compensation occurs during contouring, chamfering, and other multi-axis operations.

operators

A person trained to run a specific type of CNC machine on a daily basis. Operators monitor and adjust machining operations.

optional stop

A code in a part program that pauses the machining cycle at key moments. Optional stops can be manually turned off so that the program completes without stopping.

outer diameter

OD. The external surface of a workpiece. Outer diameter cutting operations on the lathe include turning, facing, and cutoff.

P code

A word in a canned cycle that indicates the starting block number of the final toolpath. A P code refers the part program back to a line containing a specific N code.

part programmer

The person responsible for the creation of a part program. The part programmer translates a workpiece design into program instructions for a machine control unit.

part programs

A series of alphanumerical instructions used by a CNC machine to perform the necessary sequence of operations to machine a specific workpiece. Multiple part programs can be stored in a CNC at one time.

peck drilling

A drilling operation that periodically retracts the tool to clear chips or flood the hole with coolant. Peck drilling is often used for holes that are three or four times deeper than the drill diameter.

prismatic

A solid geometric figure with two end faces that are parallel polygons whose corners are connected by perpendicular lines. Prismatic parts are machined using CNC mills.

program zero

The position that acts as the origin for the part program of a particular workpiece. Program zero is located at the coordinates X0 Z0.

prove out

Performing a series of steps to verify the accuracy of a part program. Operators should prove out a program to ensure all tool movements follow the correct paths.

Q code

A word in a canned cycle that indicates the ending block number of the final toolpath. A Q code refers the part program back to a line containing a specific N code.

Q code

A word in a peck drilling canned cycle that indicates how far to feed the drill into the part for each peck. Q codes are also used to indicate the ending block number of the final toolpath in a G70 finish turn canned cycle.

R code

A word in a holemaking canned cycle that describes the location of the R level. An R code tells a G83 peck drilling canned cycle how far out to retract the cutting tool from the surface of the part.

R level

The imaginary plane parallel to the X axis or Z axis indicating the cutting tool clearance plane. An R level indicates the safe distance for rapid tool movement from one operation to the next.

radius

The linear distance between a point on the periphery of a circle and the circle's center point. An X code usually indicates a part's radius on a lathe.

rapid

To move a machine component at the fastest possible rate of travel. Rapiding is also known as rapid positioning.

rapid positioning

The movement of machine components at the fastest possible rate of travel. Rapid positioning merely requires an endpoint for the movement.

revolutions per minute

rpm. The number of revolutions that a spindle or cutting tool completes in one minute. Revolutions per minute is a measurement of speed in both the English and metric systems.

rough

A metal cutting process that emphasizes high material removal rates at the possible sacrifice of surface finish or accuracy. Roughing operations usually occur in multiple passes.

rpm

Revolutions per minute. The number of revolutions that a spindle or cutting tool completes in one minute. Rpm is a measurement of speed in both English and metric systems.

rpm

revolutions per minute. The number of revolutions that a spindle or cutting tool completes in one minute. Rpm is a measurement of speed in both the English and metric systems.

S code

A word in a part program that determines the spindle speed during a cutting operation. S codes are usually given in surface feet per minute (sfm), meters per minute (m/min), or revolutions per minute (rpm).

sfm

surface feet per minute. The distance in feet that the workpiece surface travels in one minute. Sfm depends on both workpiece size and revolutions per minute (rpm).

speed

The rate at which the machine spindle rotates. Speed affects how fast the workpiece moves.

speed

The rate at which the spindle rotates. Rotational speed indicates how fast the workpiece is spinning.

spindle

The part of a machine tool that rotates. On a lathe, the spindle rotates the workpiece.

surface feet per minute

sfm. The distance in feet that the workpiece surface travels in one minute. Surface feet per minute depends on both workpiece size and revolutions per minute (rpm).

T code

A word in a part program used to indicate the specific cutting tool for a tool change. T code numbers indicate the position in the turret or toolchanger in which the specified cutting tool is located.

taper

A gradual decrease from a larger size to a smaller size at a constant slope or incline. A taper on a cylindrical part affects its entire diameter.

template

A format that repeats a series of potentially redundant information to ensure that no mistakes occur. A template of certain blocks of code should occur at the beginning of a part program and each toolpath.

toolpaths

A series of program blocks that describes the movement of a single cutting tool. Toolpaths are typically generated using computer-aided manufacturing.

turned

A machining operation that rotates a cylindrical workpiece while a single-point tool is guided along the length of the part. Turning is performed on a lathe.

turret

A lathe component that holds a number of cutting tools. Turrets rotate or index to place tools in cutting position.

U code

A word in a canned cycle that determines the stock remaining along the X axis. A U code, along with a W code, is required to run a G71 rough turning canned cycle.

U code

A word in a part program used to indicate an incremental position along the X axis. U codes are also used in rough turn canned cycles to leave a small amount of stock for finishing.

velocity

The combination of an object's speed and direction of motion. A constant surface speed ensures a steady velocity.

W code

A word in a canned cycle that determines the stock remaining along the Z axis. A W code, along with a U code, is required to run a G71 rough turning canned cycle.

W code

A word in a part program used to indicate an incremental position along the Z axis. W codes are also used in rough turn canned cycles to leave a small amount of stock for finishing.

words

The pairing of an address letter and a numerical value in a part program. Words, also known as codes, combine to make up a program block.

workholding devices

Equipment used to support, locate, and clamp a workpiece for a manufacturing operation. The workholding device used on a CNC lathe is usually either a chuck or a collet.

workpiece

A part that is in the process of being manufactured. A workpiece may be a complete product in itself or one component of a product consisting of many parts.

X axis

The linear axis representing coordinate positions along a line parallel to the spindle's centerline. A CNC lathe’s X axis usually relates to a part's diameter.

X code

A word in a part program that describes a specific position along the X axis. X codes are usually used for both CNC mills and CNC lathes.

Z axis

The linear axis representing coordinate positions along a line parallel to the spindle. A CNC lathe's Z axis usually moves the cutting tool toward or away from the part's face.

Z code

A word in a part program that describes a specific position along the Z axis. Z codes are usually used for both CNC mills and CNC lathes.