CNC

Basics of G Code Programming 231

Basics of G Code Programming provides a comprehensive introduction to G code programming. Programmers use G codes to create part programs, which direct CNC machines to create a part. Part programs consist of blocks, which contain words that are a combination of a letter address and a numerical value. N codes name or title a program block. G codes describe the operation that the machine will perform. X, Y, and Z codes determine the cutting operation location. F and S codes set the feed and speed, T codes signal the correct cutting tool, and M codes complete other miscellaneous functions.

Programmers often rely on computer-assisted programming software to efficiently create part programs. However, to create or edit a part program for a CNC machine, a programmer must understand the different codes in G code programming and what they do. After taking this class, users should be able to describe how G code programming is used to create a part program.

  • Difficulty Intermediate

  • Format Online

  • Number of Lessons 16

  • 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 Programs
  • The Purpose of a Part Program
  • From Blueprint to Program Coding
  • Sequence of Part Machining
  • Programming Standards
  • Computer-Aided Manufacturing
  • Program Blocks and Addresses
  • Block Numbering
  • G Codes
  • X, Y, and Z Codes
  • CNC Programming
  • F and S Codes
  • T and M Codes
  • Blocks in Sequence
  • Components of a Part Program
  • Word Types
Objectives
  • Describe the role of a part program.
  • Describe the role of a part program.
  • Identify the major steps in program creation.
  • Explain how standardization impacts CNC programs.
  • Define computer-aided manufacturing.
  • Identify the components of a program.
  • Describe the function of N codes.
  • Describe the function of G codes.
  • Describe the function of coordinate codes.
  • Describe the function of F and S codes.
  • Describe the function of T and M codes.
  • Describe a toolpath.
Glossary
Vocabulary Term
Definition

A axis

The rotational axis describing motion around the X axis. A axis movement can be in a clockwise or counterclockwise direction.

address

The letter used within a word that signals the essential function of the word. The address in a G code, for example, is the letter "G."

American Standard Code for Information Interchange

ASCII. A universal language in which CNC machines communicate. The American Standard Code for Information Interchange is more commonly known as ASCII text.

B axis

The rotational axis describing motion around the Y axis. B axis movement can be in a clockwise or counterclockwise direction.

blocks

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

blueprint

A document that contains all of the instructions and information necessary to create and inspect a quality part. Blueprints include three main elements: the views, their dimensions, and the notes.

C axis

The rotational axis describing motion around the Z axis. The C axis describes the rotation of a machine spindle.

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.

CNC

Computer numerical control. A self-contained system of computers and precision motors that executes program instructions to guide machine tool components and manufacture parts. CNC machines use part programs to control the cutting operations required to create a part.

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. Computer numerical control machines use part programs to control the cutting operations required to create a part.

computer-aided manufacturing

CAM. The use of computer software that facilitates the development of part programs. Computer-aided manufacturing software creates an image of the workpiece and develops the program code from information input by the programmer.

conversational interface

An interface that asks the user a series of questions to gain data. Conversational interfaces then translate the user's answers into programmable code.

cutting fluid

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

dry run

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

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 or inches per revolution.

feed

The rate at which the cutting tool and the workpiece move in relation to one another. Feed is typically a linear movement.

G code

A word in a part program that determines the type of operation a CNC machine performs. G codes can be either standardized or customized.

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.

inches per minute

ipm. A unit of measurement that indicates how far in inches a tool advances in one minute. Inches per minute is used to measure feed.

inches per revolution

ipr. A unit of measurement that indicates how far in inches a tool advances in one rotation. Inches per revolution is used to measure feed.

linear interpolation

Machine tool movement along more than one axis at once. Linear interpolation is indicated in a part program by the word G01.

M code

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

machine control unit

MCU. A small, powerful computer that controls a CNC machine. Machine control units offer standard canned cycles as well as special canned cycles.

machine zero

A position that is permanently set by the manufacturer of each particular CNC machine. Machine zero acts as the home position for a given machine.

MCU

Machine Control Unit. A small, powerful computer that controls a CNC machine. Machine control units offer standard canned cycles as well as special canned cycles.

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.

N code

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

offset

A numerical value stored in the CNC machine control unit that repositions machine components. Offsets can be indicated in a part program using the G code G56.

operator

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

part program

A series of alpha-numeric instructions that direct 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 the workpiece design into program instructions for the CNC.

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.

revolutions per minute

rpm. The number of revolutions a spindle or cutting tool completes in one minute. Revolutions per minute is a measurement of speed in both 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 or revolutions per minute.

speed

The rate at which the machine spindle rotates. The spindle speed affects how fast the cutting tool moves at the point of contact.

speed

The rate at which the spindle rotates. Speed indicates how fast the cutting tool or workpiece is spinning.

spindle

The part of a machine tool that rotates. Spindles may rotate a workpiece or a cutting tool, depending on the machine type.

standardized

Using an established rule or set of expectations. Standardized CNC machine coordinates and programming language allows part programs to function on a variety of machines.

surface feet per minute

sfm. The distance, in feet, that the cutting surface and workpiece move past one another at the point of contact in one minute. Surface feet per minute depends on depends on cutting diameter or cutting tool 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 turret or toolchanger where the specified cutting tool is located.

tool length offset

A measurement used on a CNC mill to account for variations in tool length along the Z axis. Tool length offsets are required for each cutting tool.

toolchanger

A device on a milling machine that arranges multiple tools in order and positions these cutting tools for replacement. The toolchanger also stores the cutting tools between uses.

toolpath

A series of program blocks that describes the movement of a single cutting tool. CAM is typically used to generate toolpaths.

toolpath

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

turret

A lathe component that holds a number of cutting tools. The turret rotates to place tools in the cutting position.

word

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

workholding devices

Equipment used to support, locate and clamp a workpiece for a manufacturing operation. Workholding devices include vises, clamps, chucks, and collets.

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.

worktable

The component of a CNC mill that supports the workpiece and any workholding device during machining. The worktable moves 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 usually runs left-to-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 usually runs 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 but not for CNC lathes.

Z axis

The linear axis representing coordinate positions along a line parallel to the spindle. The Z axis usually runs 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.