G96 / G97 Gcode: Programming Examples & Theory (2024)

Table of Contents

What is Constant Surface Speed (G96 CNC Code)?

G96 / G97 Gcode: Programming Examples & Theory (1)

In machining,constant surface cutting speedmeans programming a CNC lathe to maintain aconstant relative velocity between the cutter and the workpiece (Known as the “Cutting Speed”). It is achieved by letting the machine control the spindle RPM according to the working diameter. As the cutting edge gets closer to the center of the workpiece (smaller diameter), the RPM increases to maintain a constant cutting speed.

G96 is the modal Gcode command that instructs the CNC controller to enter a “constant surface cutting speed”. Any motion CNC code that will be entered afterward will behave accordingly. (See the Gcode examples below)

Formulas to calculate the required RPM that will yield the needed cutting speed.

The formulas below calculate the spindle speed that the CNC controller will request when a certain cutting speed is entered in G96 mode. (Pay attention that the formulas are different for Imperial and Metric units.)

Imperial Units Formula

\( \large RPM = \huge \frac{12 \times V_c}{\pi \times d} \)

  • Vc in SFM (Surface Feet per minute)
  • Play around in the calculator to test the formula.

Metric Units Formula

\( \large RPM = \huge \frac{1,000 \times V_c}{\pi \times d} \)

  • Vc in meters per minute.
  • Play around in the calculator to test the formula.

Learn more about cutting speed formulas and units in our Cutting Speed Page

What is Constant RPM (G97 CNC Code)?

In machining,constant RPMmeans programming a CNC lathe tomaintain the spindle’s RPM constant. Because of this, the Surface Speed (SFM / #0excludeGlossary) varies when machining at different diameters. As the cutter gets further away from the center of the workpiece, the cutting speed increases.

G97 is the modal Gcode command that instructs the CNC controller to enter “constant spindle speed” mode. Any motion CNC code that will be entered afterward will behave accordingly. (See the Gcode examples below)

Formulas to determine the cutting speed for a certain RPM

The formulas below calculate the obtained cutting speed (SFM / #1excludeGlossary) when a certain spindle speed is programmed in G97 mode. (Pay attention that the formulas are different for Imperial and Metric units.)

Imperial Units Formula

\( \large V_c= \huge \frac{RPM \times \pi \times d}{12} \)

  • Vc in SFM (Surface Feet per minute)
  • Play around in the calculator to test the formula.

Metric Units Formula

\( \large V_c= \huge \frac{RPM \times \pi \times d}{1000} \)

  • Vc in meters per minute
  • Play around in the calculator to test the formula.

When to use G96?

  • The default is to use constant cutting speed mode (G96) since the cutting tool is “feeling” the cutting speed, not the spindle speed.
  • Recommended cutting conditions and carbide grades provided by cutting tools suppliers are charted according to the cutting speed. Therefore, it is easier to program accordingly.
  • It will improve tool-life reliability.
  • Maintaining a known cutting condition in different applications will be easier without re-calculating the spindle speed.

When to use G97?

  • When face turning, the cutter gets closer and closer to the axis of the workpiece, eventually reaching zero diameter. Using G96, the RPM will increase as the cutting edge gets closer to the center, ultimately reaching the machine’s maximum spindle speed limit. Therefore, using G97 enables more control.
  • The same arguments apply when parting of a workpiece.
  • Vibrations are directly affected by the spindle speed and not the cutting speed. Therefore, when vibration issues occur, it is easier to control them when the RPM is constant. Once you find an RPM that eliminates the vibrations, it might be better to maintain it.

G96 & G97 – CNC Programming Examples.

Choose units

ImperialMetric


G96 / G97 Gcode: Programming Examples & Theory (2)

Constant SFM (G96 G code Example)

N10 G20; (Imperial Inch Units)
N20 G96 S300; (CSS – Constant SFM=300)
N30 G00 Z0 X1.0; (Positioning)
N40 G01 Z2.0 F0.01 (Turning 1")
N50 G00 Z3 X2.0; (Positioning)
N60 G01 Z4.0 F0.01 (Turning 2")

Explanation:

  • Line N20 – The cutting speed is defined as 300 SFM
  • The spindle speed is calculated by the formulas:

\( \large RPM = \LARGE \frac {12 \,\times\, SFM}{ \pi \,\times\, d} \)

  • Line N40 – As a result, at a diameter of 1″, the spindle speed will be 1146 RPM.
  • Line N60 – As a result, at a diameter of 2″, the spindle speed will be 573 RPM.
  • The Surface Speed (SFM) stayed constant, and the spindle speed varied by 50%.
  • Notice: In reality, the actual speed might be slower if the calculated RPM is higher than the machine’s maximum or is larger than the limit set in G50.
G96 / G97 Gcode: Programming Examples & Theory (3)

Constant SFM (G97 G code Example)

N10 G20; (Imperial Inch Units)
N20 G97 S700; (Constant RPM n=700)
N30 G00 Z0 X1.0; (Positioning)
N40 G01 Z2.0 F0.01 (Turning diameter 1")
N50 G00 Z3 X2.0; (Positioning)
N60 G01 Z4.0 F0.01 (Turning diamaeter 2")

Explanation:

  • Line N20 – The Spindle Speed is defined as 700 RPM
  • The cutting speed (SFM) at each diameter is calculated by the formula:

\( \large SFM = \LARGE \frac {n\,\times\,\pi \,\times\, d}{12} \)

  • Line N40 – As a result at a diameter of 1″, the Surface Speed will be 183 SFM
  • Line N60 – As a result at a diameter of 2″, the spindle speed will be 365 SFM
  • As you can see, the cutter will “feel” a different cutting speed at different diameters.

Learn about more G-Codes

Related Glossary Terms:

  • Cutting Speed
  • CNC Machine
  • Spindle
  • RPM
  • Cutting Edge
  • Grade
  • Turning
  • Parting Off
G96 / G97 Gcode: Programming Examples & Theory (2024)

FAQs

What is the G96 and G97 CNC code? ›

In G-code, G97 is constant speed such as turning a round bar on a lathe. G96 is used to speed up or slow down the spindle speed to maintain a constant rate of material removal. Used in facing, it would speed up the spindle as the tool approaches the center.

What is the difference between G96 and G97 lathe? ›

G96 and G97 G-Codes

We have two different modes to choose from when controlling the rotational speed of our component, the G96 constant surface cutting speed and the G97 constant spindle speed.

What is G96 in G-code? ›

G96 G-Code: Constant Surface Speed CNC Programming by CNC Cookbook. G96 controls the speed of the workpiece spindle on a CNC lathe.

What is the G97 code in Haas? ›

Lathe - G-Codes
G-CodeDescriptionGroup
G97Constant Surface Speed Off13
G98Feed Per Minute10
G99Feed Per Revolution10
G100Disable Mirror Image00
115 more rows

How to calculate cutting speed? ›

Cutting Speed = πDN / 1000 m/min. To keep the cutting speed constant while machining various diameters, the spindle rpm is varied. Find the cutting speed, when a cylinder of 25 mm diameter is machined at 4500 rpm. The formula to find the cutting speed is = πDN / 1000 m/min.

When S is programmed with G96, what does S stand for? ›

To set constant surface speed mode, program: G96 D~ S~ D~ is the maximum spindle RPM. This word is optional. S~ is the surface speed.

What is the G-code for CNC tapping? ›

For any tapping operation, a hole must be drilled first. In CNC, G81 will center drill and drill before the tapping operation begins. Tapping is a three-step process. The code for the tapping canned cycle is G84.

What is the S code in CNC? ›

S-Codes: These are speed codes, and represent the desired tool spindle speeds at different times during the machining process. T-Codes: These identify the tool to be used when machining a specific feature on the workpiece.

How to generate G-code for CNC machine? ›

How can you use CAD/CAM software to generate G-code for CNC machines?
  1. Step 1: Create a CAD model. ...
  2. Step 2: Define the CAM parameters. ...
  3. Step 3: Generate the G-code. ...
  4. Step 4: Transfer the G-code to the CNC machine. ...
  5. Benefits of using CAD/CAM software to generate G-code. ...
  6. Here's what else to consider.
Nov 8, 2023

What does G97 mean? ›

G97 Speed In RPM

In Basic Turning when you program G97 your machine will start the chuck up at a speed in RPM. So if you program. G97 S1500 M3. Your chuck will start revolving clockwise at 1500 rpm.

What is F code for CNC? ›

feed rate

What is the start code for CNC spindle? ›

Fanuc M-Code List (Lathe)
M codeDescription
M03Spindle start forward CW
M04Spindle start reverse CCW
M05Spindle stop
M08Coolant on
17 more rows

What does G92 mean in CNC? ›

This command is used set temporary work offset values. The temporary work offsets are used in combination to the main work offsets G54 to G59. Applying a temporary work offset to an axis will change the working coordinate of the axis to the specified value.

What is G95 in CNC? ›

G95 (Feed Per Revolution) is a modal G-code that instructs the control to interpret feed commands as mm per revolution (mm/rev) or inches per revolution of the spindle.

What does G94 mean in G-code? ›

per minute feed

Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 5700

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.