Creating a CNC Milling Program 302

“Creating a CNC Milling Program” illustrates the process of creating a part program for a CNC mill. Writing the part program is only one step in the process of creating a part. The toolpaths created within a part program depend upon the sequence of operations necessary to machine a part. Different G code programming codes perform the different tasks within the part program, from setting speed and feed to activating rapid positioning. Canned cycles and subprograms help to short the length of part programs.

All programs need to be checked by proving out. Programming and how it relates to the axes on a CNC mill are critical for a programmer to successfully 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 rectangular part on the CNC mill.

Class Details

Class Name:
Creating a CNC Milling Program 302
Description:
“Creating a CNC Milling Program” illustrates the process of creating a part program for a CNC mill. Writing the part program is only one step in the process of creating a part. The toolpaths created within a part program depend upon the sequence of operations necessary to machine a part. Different G code programming codes perform the different tasks within the part program, from setting speed and feed to activating rapid positioning. Canned cycles and subprograms help to short the length of part programs.

All programs need to be checked by proving out. Programming and how it relates to the axes on a CNC mill are critical for a programmer to successfully 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 rectangular part on the CNC mill.
Version:
2.0
Difficulty:
Advanced
Number of Lessons:
23
Related 1.0 Class:
Creating a Milling Program 290

Class Outline

  • Part Programs
  • Creating a Part Program
  • Toolpaths
  • Types of Motion
  • Steps of Program Creation
  • Programming Tool Movements
  • Startup Codes
  • Tool Changes
  • Feed and Speed Codes
  • Using a Template
  • Part Program Review
  • Creating the Sample Part
  • Face Milling Operation
  • Pocket Milling Operation
  • Circular Interpolation Methods
  • Arc Center vs. Radius
  • Pocket Milling Subprogram
  • Canned Cycles
  • Drill, Peck Drill, and End Mill Operations
  • Drill, Peck Drill, and Tapping Cycles
  • Completed CNC Mill Part Program
  • Proving Out
  • Program Blocks

Objectives

  • Describe the role of a part program.
  • Describe 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.
  • Describe how program codes translate into tool movement.
  • Identify common codes located at the beginning of a toolpath.
  • Identify the codes that perform tool changes.
  • Identify the cutting variable measurements used in speed and feed codes.
  • Identify the role of templates in a program.
  • Explain how to program face milling operations using G code programming.
  • Explain how a pocket milling operation is programmed using G code programming.
  • Distinguish between the arc center and radius methods for programming circular interpolation.
  • Explain the execution of a subprogram.
  • Describe a canned cycle.
  • Explain how the drilling and milling of holes is programmed using G code programming.
  • Explain the parameters necessary to program tapped holes in G code programming.
  • Describe the purpose of proving out.

Certifications

NIMS
  • CNC Milling Programming, Setup, & Operation

Glossary

Vocabulary Term Definition
absolute coordinate A series of numerical positions that are calculated from a fixed point of origin. Absolute coordinates are the most conventional and commonly used.
arc center method A method for programming circular tool movements that requires an I code and a J code to indicate the location of the arc’s center along with the X and Y codes that note a point along the arc’s periphery. The arc center method is best used for full-arc motions.
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 an existing hole with a single-point tool. Boring can be performed on a mill as long as it has the appropriate boring cutting tool.
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.
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. Mills 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. Computer-aided manufacturing software applications create an image of the workpiece and develop the program code from information that the programmer inputs.
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.
cutter radius compensation An offset used on the CNC mill that accounts for variations in tool diameter. Cutter radius compensation is necessary only for tools that continuously cut along a horizontal plane.
cutting variable A changing value that occurs during cutting operations. Cutting variables include speed and feed.
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.
depth The measurement that the cutting tool penetrates the surface of the workpiece. On a mill, depth is dictated by the movement of either the spindle or the worktable.
drill A metal cutting tool used to penetrate the surface of a workpiece and make a round hole equal to the drill diameter. Drills have multiple cutting edges.
drilling The use of a multi-point tool to machine a new round hole into the surface of a workpiece. Drilling can be performed on a mill, as long as it has the appropriate drill cutting tool.
dry running A preliminary operation to ensure that a part program will machine workpieces properly. A dry run is performed without any parts or coolant.
end mill A type of milling cutter that performs a mix of peripheral and face milling with its bottom and side cutting edges. End mills can be used to machine grooves, slots, circular slots, pockets, and contours.
end milling A milling operation in which the cutting edge of the mill is parallel to the axis of rotation. End milling primarily cuts with the side edges of the cutting tool.
English system 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), inches per revolution (ipr), millimeters per minute (mm/min), or millimeters per revolution (mm/rev).
face mill A type of mill cutter that contains multiple teeth surrounding its large body diameter. A face mill uses the bottom as a cutting surface to mill large flat surfaces.
face milling A milling operation in which the surface of the workpiece is perpendicular to the spindle axis. Face milling primarily cuts with the bottom edge of the cutting tool.
feed The rate at which the cutting tool moves along the surface of a workpiece on a mill. Feed is typically a linear movement.
finishing A cutting pass that emphasizes tight tolerances and smooth surface finish. Finishing is usually the last step in the machining process.
fixture A customized workholding device used to position and hold a part during various machining operations. Fixtures are built to hold a specific part design.
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 clockwise circular interpolation. G03 move tools along a curved cutting path.
G40 A code in G code programming that cancels cutter radius compensation. G40 removes any offsets caused by a cutting tool's diameter.
G43 A code in G code programming that instructs the MCU to adjust for geometry offset. G43 adjusts for the length of the cutting tool.
G54 A code in G code programming that instructs the MCU to adjust for workshift offset. G54 changes the position of the spindle in the X and Y axes and often the X axis as well.
G80 A code in G code programming that cancels a mode. G80 is used to end a canned cycle.
G81 A code in G code programming that generally activates the general drilling canned cycle. During the G81 canned cycle, the cutting tool positions to a hole location, drills a hole, and then exits out of the hole.
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.
G84 A code in G code programming that generally activates the right-hand tapping canned cycle. The G84 canned cycle cuts a thread by rotating a multi-point cutting tool clockwise as it enters a hole.
G90 A code in G code programming that set tool movement in absolute coordinate mode. G90 indicates that the next coordinate position in a part program should be determined based on a fixed point of origin.
G91 A code in G code programming that set tool movement in incremental coordinate mode. G91 indicates that the next coordinate position in a part program should be determined based on the location of the current position.
G99 A code in G code programming that instructs the cutting tool to return to the R level or clearance plane. G99 codes are often used at the end of canned cycles.
geometry offset A cutter compensation that adjusts a part program for tool length. Geometry offset is different for each tool.
H code A word in a part program used to indicate the matching geometry offset for a particular cutting tool. H code numbers must match the T code number in its toolpath.
holemaking The act of machining a hole into the interior surface of a workpiece. Holemaking can be accomplished by drilling, boring, reaming, and tapping.
home position The position on a CNC mill located the farthest possible distance in a positive direction along the X, Y, and Z axes. Home position is also known as machine zero.
I code For circular interpolation, the program code that indicates the location of the arc’s center along the X axis. I codes and J codes are used for the arc center method.
inches per minute ipm. The distance in inches that the entire tool advances in one minute. Inches per minute is the measurement for feed of a rotating cutting tool on a mill.
inches per revolution ipr. The distance in inches that the tool advances along the workpiece during one complete revolution of the spindle. Inches per revolution is a measurement for feed on the lathe and must be converted into inches per minute for CNC milling programs.
inches per tooth ipt. The linear distance traveled by a cutting tool during the engagement of a single cutting edge. Inches per tooth is the feed measurement for multiple cutting edge tools and must be converted into inches per minute for CNC milling programs.
incremental coordinate 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.
ipm inches per minute. The distance in inches that the entire tool advances in one minute. Ipm is a measurement for feed.
J code For circular interpolation, the program code that indicates the location of the arc’s center along the Y axis. J codes and I codes are used for the arc center method.
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 code A word in a part program used to signal an action from a miscellaneous group of commands. M codes change cutting tools, 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.
M98 An M code that instructs a machine control unit to jump to a subprogram in a part program. M98 requires a P code that tells the MCU which subprogram to use.
M99 An M code that instructs a machine control unit to return to the main part program after a a subporgram has been completed. M99 occurs at the end of a subprogram.
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.
machine zero The position on a CNC mill located the farthest possible distance in a positive direction along the X, Y, and Z axes. Machine zero is also known as home position.
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, or smm.
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.
millimeters per tooth mm/t. The linear distance traveled by a cutting tool during the engagement of a single cutting edge. Millimeters per tooth is the feed measurement for multiple cutting edge tools and must be converted into millimeters per minute for CNC milling programs.
mode A programmed function that stays in effect until it is either cancelled or substituted with another function. The modes of motion for CNC machines include rapid positioning, linear interpolation, and circular interpolation.
offsets A numerical value stored in the CNC machine control unit that repositions machine components. Offset information in a CNC milling program is provided by an H code.
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, M01, which pauses the machining cycle at key moments. Optional stops can be manually turned off so that the program completes without stopping.
P code A program code that indicates the name of the subprogram an MCU should execute. P codes are preceded by the word M98 to call a specific subprogram in a part program.
part program 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.
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.
peck A single pass of a peck drilling cycle. A complete peck drilling cycle is comprised of a number of pecks.
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.
pocket An interior recess that is cut into the surface of a workpiece. Pockets may be round or rectangular and generally are created using an end mill.
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 unique to each workpiece design and is selected by the part programmer.
prove out To perform a series of steps to verify the accuracy of a part program. Operations should prove out a program to ensure all tool movements follow the correct paths.
Q code A word in a part program that indicates how far to feed the drill into the part each time. A Q code is required to run a peck drill canned cycle in a part program.
R code For circular interpolation, the program code that indicates the length of the arc’s radius. In certain canned cycles, an R code indicates the R level for tool return.
R code In certain canned cycles, an R code indicates the R level for tool return. For circular interpolation, the program code that indicates the length of the arc's radius.
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 an arc and the center point of the arc. A radius or center point and a point along a circle's periphery are both required to form an arc with the radius method.
radius method The linear distance between a point on the periphery of an arc and the center point of the arc. The radius method forms an arc using a point along its periphery and either the location of the center point or the radius.
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 the measurement for speed in both the English and metric systems.
right-hand tapping A cutting operation that cuts a thread by rotating a multi-point cutting tool clockwise as it enters a hole. Right-hand tapping occurs using the canned cycle G84.
roughs A cutting pass that removes material without regard to surface finish. Roughing is often used to separate part pieces from a single sheet of material.
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).
speed The rate at which the spindle rotates. Rotational speed indicates how fast the cutting tool spins.
spindle The part of a machine tool that rotates. On a mill, the spindle rotates the cutting tool.
spot drilling A drilling operation that uses a shorter, sturdier drill to create a small hole that prevents the regular drill from wandering off center. Spot drilling often uses a drill size slightly larger than the hole diameter to leave a chamfer after the hole is drilled.
subprogram A program separate from the main program that executes a series of operations occurring multiple times during the machining cycle. Subprograms shorten and simplify manual programming, are called from the main program with M98 and a P code, and are terminated with M99.
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 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 toolchange or turret that the specified cutting tool is located.
tapping The process of cutting internal threads in a hole with a rotating multi-point tool. Tapping can be performed on a mill, as long as it has the appropriate tap cutting tool.
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.
threads A long, spiral ridge around the exterior or interior of a cylindrically shaped object. Threads are used to fasten or provide motion.
toolchanger A milling machine device that arranges and positions multiple cutting tools for the spindle to retrieve. The toolchanger also stores the cutting tools between uses.
toolpaths A series of program blocks that describes the movement of a single cutting tool. Complex toolpaths are typically generated using computer-aided manufacturing.
velocity The combination of an object's speed and direction of motion. Velocity is measured in surface feet per minute (sfm) or meters per minute (m/min).
vise A workholding device with two jaws that grip and hold a workpiece in place. Vises are mostly used to hold rectangular workpieces with fairly simple dimensions.
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.
workshift offset An offset used to adjust the location of every tool loaded in the machine. On the mill, the workshift offset changes the position of the spindle in both the X and Y axes and often the Z axis as well.
worktable The component of a CNC mill that supports the workpiece and any workholding device during machining. Worktables move on some CNC mills.
X axis The linear axis representing coordinate positions along a line parallel to the longest edge of the worktable. The X axis on a CNC mill usually moves the cutting tool left and right.
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.
Y axis The linear axis representing coordinate positions along a line parallel to the shortest edge of the worktable. The Y axis on a CNC mill usually moves the cutting tool back and forth.
Y code A word in a part program that describes a specific position along the Y axis. Y codes are usually used for CNC mills.
Z axis The linear axis representing coordinate positions along a line parallel to the spindle. The Z axis on a CNC mill usually moves the cutting tool up and down.
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.