G98 and G99 It’s About Jumping Things

G98 and G99 It’s About Jumping Things

G98 and G99 It’s About Jumping Things

G98 and G99, a canned cycle is usually one line of code for example to drill a hole. This one line of code tells the machine all it needs to know about drilling my holes.

  •  Depth
  •  Feed-rate
  •  A point in the Z axis to rapid to before drilling
  •  Point to rapid back to after drilling
Sample program of G81 Drilling Cycle G98 and G99
G81 Drilling Cycle Sample Program G98 and G99

What happens then is each time you give the machine a new position it will drill one of these holes.

This is great because you don’t have to worry about what’s going to happen.

Each hole will be identical unless you change one of the parameters in the cycle like the Z depth or the feed-rate.

Therefore if on one hole you put a different Z depth that hole and all subsequent holes will be to the new depth.

Easy As ABC

So all in all it’s a really easy way to drill holes. You tell it what you want and then each time you give a position you get a hole. Then when you get sick of drilling holes you type in G80 and it stops drilling holes.

Machine says “OK this turkey doesn’t want anymore holes” so from now on when the machine moves to a position nothing happens.

Mitsubishi Drill In Action G98 and G99
Mitsubishi Drill In Action

Mitsubishi Carbide

There are loads of Canned Cycles I can’t be bothered to tell you about them all cos I’m going out tonight otherwise I would explain them all. If you scrat around this website for a while you’ll find them all.

Anyway they all do different shit.

They all work in the same way but with some variations.

Now the video at the bottom of the page is about G98 and G99.

G98 and G99 are in all of the drilling and tapping cycles. You have one or the other. You can even miss it out if you can’t be arsed with it.

OK so assuming I want it, what does it do?

You may well ask.

I know for a fact that some of you, and I won’t mention names, put this on the line with the canned cycle but you ain’t got a clue what it does. Maybe you don’t even put it in because you’re frightened of what it might do..

Now’s the time to learn or you will have it on your conscience for the rest of your life.

By the way if you don’t give a flying shit what it does then I wouldn’t waste anymore time reading this.

Here is a lovely video on kittens for you to watch. Off you go.

G98 and G99 How it works.

If you prefer  dogs read on.

  1. First of all the tool will rapid to what we call an initial point which the control remembers ready in case you decide to program G98. (This is the last Z move you made before the cycle is called).
  2. The tool will then rapid down close to the hole (this is called the R point). Don’t make this too far away or you will waste movement.
  3. Tool feeds down in Z to the Z depth at the feed-rate you specified.
  4. Then the tool will rapid back out of the hole. It can either rapid out to initial point (1) or the R point (2) depending on if you programmed G98 or G99.
Parts of the G81 drilling cycle with G98 and G99
How G81 works in action

Now if you program G99 it returns to the R point (2)
If you program G98 it returns to the initial point  (1)

OK why on earth would I want that? Maybe you wish you had chosen to watch the kittens video, but read on.

Well……. if you made that initial point 50mm above the job (about 2 inches) and the rapid point was 1mm above the job (.040 inches).

You could drill all your holes in G99 and the drill would each time return to 1mm (.040 inches) above the part.

If you add a clamp to jump over just put G98 on the hole before and it will jump to 50mm (2 inches) above the part. Oh and it misses the clamp.

Change back to G99 and it stays down returning to 1mm (0.040 inches) above the part.

Admit it, you like it don’t you?

Please don’t try this at home by the way.

Get it? So you eliminate wasted moves. Good init.


demonstration of G98 and G99 in action
G98 and G99 in Action

Oh and here is my video it explains how to use G98 and G99 to jump over clamps on a fixture.

The video is shit by the way but I had to learn (it’s been ages ago).

If you are completely crazy and you like this video, please don’t forget to subscribe to my YouTube channel by going to: CNC Training Centre

Please contact me if you require:

  • CNC programming training.
  • Want to learn CNC programming.
  • Fanuc control training.
  • Yasnac programming training.
  • Any type of CNC course.
  • Fanuc training courses
  • CNC lathe training
  • CNC Vertical Machining Centre training
  • Siemens Training
  • Hatha Yoga
  • Flower arranging

Services offered at CNC Training Centre

Edgecam Training.

Classroom programmer training.

Onsite CNC Machine Training.

CNC Training on all controls and machines.

Mazak Training Fanuc Training

Don’t forget we offer training on all types of Mazak Machines and all Fanuc Controls 6m to 31i Oi old to young.

Rigid Tapping G84 Canned Cycle

Rigid Tapping G84 Canned Cycle.

Let’s face it tapping on a CNC Machine can be a “right pain in the arse” as we say in the Midlands. But help is at hand. All you need is a bit of knowledge and the right equipment and it’s a dream, an absolute pleasure.

Rigid Tapping G84 Canned Cycle

What is Rigid Tapping?

You mean you didn’t know? Well the first step is admitting you didn’t know.

Rigid tapping means the tap can remain rigid throughout the tapping cycle. It can be held in a chuck just like an endmill or a drill. The machine spindle locks in with the feedrate just like when you are screw cutting. You can buy tapping heads specially for this. They are no different to holding in a chuck but you get to use collets for holding the tap. These make it easy to change and it can’t spin.

Oh and you don’t need to remeasure the tap if you replace it.

Rigid Tapping G84 Canned Cycle

So What Use Is This You Say

Well here are some of the advantages.

  1. No need for expensive tension and compression tapping heads.
  2. You can control the depth of the thread very accurately.
  3. It is ok to re-tap the same hole if it needs to be deeper.
  4. Peck Tapping of difficult materials is possible (Yes there is such a thing).
  5. Quicker set-up times.
  6. Feed is the same as the tap pitch.

Rigid Tapping G84 Canned Cycle

But There’s a Catch

It’s an option. Sorry you might not have it.

Most modern machines do have Rigid Tapping as standard but the older the machine the less likely it is that you will have it.

Sorry but you need to look in those boring manuals.

Rigid Tapping G84 Canned Cycle

Rigid Tapping G84 Canned Cycle, Fanuc, Haas, Mazak.

T06 M06 (M10 x 1.5 Tap)

G90 G0 G54 X50. Y50. S300 M03
G95 (Feed per rev)
G43 Z3. H06 M08
G84 G98 Z-15. R1. F1.5

On some Fanuc controls you will need M29 for rigid tapping.

T06 M06 (M10 x 1.5 Tap)

G90 G0 G54 X50. Y50. S300 M03 (S300 M03 Optional)
G43 Z3. H06 M08
G95 (Feed per rev)
M29 S300
G84 G98 Z-15. R1. F1.5
G94 (Feed per minute)

Just another interesting note (Read This G98 G99)

In the above cycle the tap will rapid down first to Z3. as in the G43 line. On beginning the cycle it will then rapid to what is know as the R Point. In this case R1. (one mm above the hole).

It will tap to a depth of 15 (Z-15). Depending on whether you programme G98 or G99 it will return to either the Z3. or the R1. before moving to the next position.

If you want to know more about G98 and G99 then read the article above.

Heidenhain Uses Cycle 207

Rigid Tapping G84 Canned Cycle


Rigid Tapping G84 Canned Cycle

Oh! And did You Know This??

G94 feed per minute (feed is in mm per minute).

G95 feed per rev (feed this amount every revolution)

These two G codes are your friend when you’re tapping or should I say G95 feed per rev is your friend.


When Rigid Tapping G84 Canned Cycle on a Fanuc, Haas, Mazak or similar control it is best to use G95. This means that when you programme your G84 (Tapping Cycle) your feedrate is your pitch.

The really great thing here is that if you change the speed of the tap you don’t change the feed because it’s the pitch.

Bet you have made that mistake before???
You change the speed and forgot to change the feed. We all know what happened next.

How easy is that?

Oh and don’t forget to change back to G94 at the end of the tapping.

You will notice the Heidenhain does this automatically for you.

Rigid Tapping G84 Canned Cycle

On Machines Like The BMC 800 from Toshiba

This machine has the Tosnuc 888 control.

T06 M06 (M10 x 1.5 Tap)

G90 G0 G54 X50. Y50.
G43 Z3. H06 M08
G95 (Feed per rev)
M843 (Synchronous Rotation command)
G84 G98 Z-15. R1. F1.5
M845 (Cancel Synchronous Rotation command)

When you don’t have rigid tapping you need a tapping head like this.

Rigid Tapping G84 Canned Cycle

Notice how it pulls out when the tap stops and reverses.

Ok So what’s Going on Here?

  1. Let’s tap a hole.
  2. Start spindle forward.
  3. Feed to depth at correct speed.
  4. Stop spindle (tap starts pulling out).
  5. Reverse spindle (tap pulls out a bit more).
  6. Start spindle (Needs to reach speed).
  7. Feed out of hole.

So the problem is that when the spindle stops, reverses and starts up everything goes wrong.

But this tension and compression tapping head can take up all the slack.

Not An Exact Science.

Definitely not, depths will vary. You will probably need to do some hand tapping too.

Tapping Clutches

These are special collets designed to slip at a certain torque. This allows you to get to depth without breaking the tap.

Rigid Tapping G84 Canned Cycle

You adjust the collar at the front to give the required torque.

You can’t use these on Rigid Tapping G84 Canned Cycle because the last thing you want is for the tap to stop rotating.

Haas Have The Answer

Rigid Tapping G84 Canned Cycle, check out this great video on how to stop the machine half way through tapping.

Recover it without busting the tap!!

Ok So Let’s Talk About Peck Tapping

Fanuc (if you have the option) is G84.2 just programme your normal tapping cycle but replace G84 with G84.2 and add a Q value which is your pecking depth.

G84.2 G98 Z-15. Q5. R1. F1.5

Why would one want to peck tap?

  1. Holes that clog with swarf.
  2. Difficult materials.
  3. To impress visitors.

Don’t Have It? Don’t Despair You Don’t Need It if You have Rigid Tapping

If you programme this.

G84 G98 Z-5. R1. F1.5

There you have it Peck Tapping.

So you move to a position and it taps a hole 5mm deep. Because you are in a canned cycle it will repeat the procedure at Z-10. Z-15. and Z-20.

How cool is that?

Thanks For Reading

Don’t forget there’s loads more folks.

And a YouTube channel

Contact Me

Services offered at CNC Training Centre

Edgecam programming and training.

Classroom programmer training.

Onsite CNC Machine Training.

CNC Programming and Training on all controls and machines.

Mazak Training Fanuc Training

Don’t forget we offer training on all types of Mazak Machines and all Fanuc Controls




CNC Milling G02 G03 to Mill a Full Circle

CNC Milling G02 G03


CNC Milling G02 G03

To produce a full circle on a Fanuc or Haas G code type programming system is really easy.

Last week I was training four very experienced programmers and I asked them how they would programme a full circle.

The answers they gave shocked me, I had to take out my hip flask and drink a large shot of brandy.

What they were doing was perfectly correct but definitely not the simplest way.

One said he broke the circle into two halves. One said he copied some code he already had in the machine. The other one said he got the bloke who did it in two halves to do it for him. Oh and the other one used I and J and X and Y.

OK so just imagine you want to mill internally around a 40mm diameter circle.

Training Courses Let Me at Em

CNC Milling G02 G03 to Produce a Full Circle, here’s the code.

First in two halves

G0 X0 Y0 S1500 M3
G43 Z3. H01 M8
G1 Z-5. F100.

G41 X20. Y0 D1 F200.    (Apply Cutter Compensation)
G3 X-20. R20.                   (First Half)
X20.                                     (Second Half)
G1 G40 X0 Y0                   (Cancel Cutter Compensation)

G0 G53 Z0

All in one complete with wasted Code

G1 G41 X20. Y0 D1 F200.
G3 X20. Y0  I-20. J0 (Mill Full Circle)
G1 G40 X0 Y0

But this is really all you need

G1 G41 X20. Y0 D1 F200.
G3 I-20.         (Mill Full Circle….. Sooo Simple)
G1 G40 X0 Y0

Remember that song by the Average white Band “Let’s Go round Again”? I used to love it.

Actually I still do, as an old twat I’m allowed to like this shit.

Ok let’s go round again. It’s so easy and it saves leaving a mark.

G1 G41 X20. Y0 D1 F200.
G3 I-20. (Mill Full Circle)
I-20.        (Lets go round again)
G1 G40 X0 Y0

Now if you have a Toshiba with Tosnuc control or Haas or maybe a Yasnac CNC control…..

CNC Milling G02 G03 to produce a full circle you just need this:

G13 D1 I20. F200. (Everything all in one)

                G13 (Counter Clockwise) G12 (Clockwise)
                D1 (Use offset 1)
                I20. (20mm Radius)

G13 does everything. It’s the an all inclusive holiday of circular milling except you don’t gain weight and you’re not pissed everyday.

How cool is that and you even get a tangential approach. At my age you’re glad of all the tangential approaches you can get.

No there is no sexual innuendo here it just means you approach the circle using a circular move. You sort of creep up when it’s not looking.

Know what I mean??

Here is a nice picture to demonstrate.

CNC Milling G02 G03

Think about it, why would we do this?

Well the older and more inaccurate your CNC machine is the more likely it is that your machine will leave a mark at the entry and exit point. This is also dependant on the material and the size of the cut you are using.

A quick workaround for this is to just go round the circle twice (let’s go round again). It very often does the trick.

CNC Milling G02 G03

Oh by the way if I saw a tangential move that big I would think it was a wasted move. (It’s just to demonstrate). You only need a short tangential move to do the job.

The easiest way to programme a tangential approach is like the ones above. Coming in from North, South, East or West on the compass.

Now look at this.

CNC Milling G02 G03

This is the best way, although it’s more difficult to programme.

I think it’s South West on a Compass?? 



The reason is that there is no axis change of direction and no animals are injured or hurt in any way during the process.

If you watch the movement above and watch carefully what the X axis is doing. It changes direction before it is in contact with the circle. And the same thing on the way out of cut with the Y axis.

Direction Change When Using G02 G03 to mill full circle

When milling a full circle each time an axis changes direction there is a chance you will be left with a visible mark on the circle. These points are North South West and East on a compass.

Watch below to see where these points are. If you have a new machine there should be no visible mark on this change of direction.

On an old machine this can be really noticeable and cause real problem.

CNC Milling G02 G03


Circular Motion and Skid Marks

If you have an old machine you will know what I mean. Those little annoying marks where the machine changes direction. If CNC Machines were underpants then these would be the skid marks.

For my American readers in the UK we call those annoying brown marks at the back of your underwear skid marks. I don’t think you get them in America.


I have been working on a 12 year old Mazak Horizontal machine recently and was amazed at just how good a circle it produced. It beats the shit out of using a reamer. Oh and you can easily adjust the size with your D offset.

CNC Milling G02 G03

Just a note. If you do use circular milling to produce a bore just remember that if your cutter is not parallel then your bore won’t be either. So don’t use that crappy old re-ground cutter. Try n get the boss to buy you a shiny new one.


CNC Milling G02 G03

oh and just one other thing………..

Measure the bore at the top and the bottom.

Simple Full Circle Programme

G1 G41 X20. Y0 D1 F200.
G3 I-20.     
G1 G40 X0 Y0

There are actually four choices which produce four totally different circles.

And potentially a scrap part. So use those machine graphics to check your code if you got em!!

CNC Milling G02 G03

G3 I-20.    (The one on the left and the one we used)

G3 I20.     (The one on the right)

G3 J20.    (The top one)

G3 J-20.  (The bottom one)

Here They Are In Action

CNC Milling G02 G03


CNC Milling G02 G03

Click for More on G02 and G03

If you want to do this on a Sinumeric Siemens 840D read this

Thanks For Reading

Don’t forget there’s loads more folks.

And a YouTube channel

Call David

Learn CNC Programming

Services offered at CNC Training Centre

Edgecam programming and training.

Classroom programmer training.

Onsite CNC Machine Training.

CNC Programming and Training on all controls and machines.

Mazak Training Fanuc Training

Don’t forget we offer training on all types of Mazak Machines and all Fanuc Controls 6m to 31i Oi old to young.





















G Code Groups What Use Are They?

Category : Fanuc Haas New Stuff

G Code Groups, every G code is in a group and I remember looking at G codes for years thinking why on earth do they do that?

I thought it was just to satisfy the geeks, it gave them more bullshit to talk about and confuse the shit out of me.

Anyway now I’m all grown up, I know exactly why G Codes are in groups.

The good news is today I am going to tell you why and….. I am going to give you a practical example.

(Be sure to read on for a free cheese on toast recipe)

Here is a list of G codes and the groups that they are in

G Code
G Code List with Groups

Hass G Code Groups do vary a little.

Now I know this is boring but please try to keep focused it gets exciting soon honestly.

If you are loosing the will to live already then off you go, this video is amazing.

I know it’s only two of us now but I will carry on. I wrote this article a bit back about macro for the over 18’s.

When you start to write serious macros you need to write alarms to protect the operator just incase he types in bollocks instead of an R number or some such thing. I told you all about this in another article.

Anyway there is also a thing I call tidying up after yourself. This is not like when you cook a meal and your ungrateful boyfriend expects you to tidy up the kitchen just because it looks like a post war bomb site.

I made cheese on toast and I must say it tasted great. Cooking’s got to be easier than this G Code shit.

Simple Cheese On Toast

Ingredients and Tools
Blow torch

Melt cheese onto toast with a blow torch
Always Wash Your Hands Before Cooking (especially if you just took a shit)

Tidy Up Your Mom Does Not work Here

I honestly thought all baths were self cleaning till I moved in with my girlfriend.

What this is about is putting things back as they were. So the G Codes that were in use before going into your macro need to be restored before coming back out of the macro.

For example most machines when you issue an M6 command jump into a macro programme. See this article

The macro programme might look something like this.

09101                           (TOOL CHANGE MACRO)
G80G40G49             (CANCEL ACTIVE G CODE) 
M9                               (COOLANT OFF)
G28 G91 Z0              (SEND TOOL BACK TO ZERO)
M19                             (SPINDLE ORIENTATION)
M6                               (TOOL CHANGE)

What this macro actually does is all the crap you can’t be arsed with.

In your main programme you would have to do all this every time you want a tool change. You don’t see any of this because the programme is not visible. The M6 aliases programme 9101. 

The machine knows you are too fuckin thick to understand it so it hides it away.

But Not Anymore

So when you programme M6 you get programme 9101 running behind the scenes.

So as I said your an advanced G Code programmer now so I expect a bit more from you. “What me” you say. “Yes you” I saw it on your CV”.

Oh and you just swapped the control into G91 in the macro above (you naughty boy)

So for example if the machines was in rapid G0 and absolute G90 the guy who called the tool-change will expect it to stay that way.


So when the control comes out of your tool change macro it’s in G91, not good.

This could easily cause a collision. You say “ah but the programmer should use G90 when he states the first position”.

Right, We Need To Talk

As I said you are an adult now and in the adult world of Macro programming you tidy up and you take responsibility for the G codes you change.

I’ll be honest with you now, lots of people who should know better don’t do this. A good example are probing macros.

Anyway what shall we do about it?

We Do This

#1=#4001                  (STORES ACTIVE G CODE IN GROUP 1)
(G0 1 G2 G3)

#3=#4003                (STORES ACTIVE G CODE IN GROUP 3)
(G90 G91)

#14=#4014             (STORES ACTIVE G CODE IN GROUP 14)
(G54 G55 G56 G57 G58 G59)

G80G40G49             (CANCEL EVERYTHING) 
M9                               (COOLANT OFF)
G28 G91 Z0              (SEND TOOL BACK TO ZERO)
M19                             (SPINDLE ORIENTATION)

G#1 G#3 G#14            (RESTORE G CODES)

OK What’s Going On Here

(G0 1 G2 G3)

(G90 G91)

#14=#4014(STORES G CODE GROUP 14)
(G54 G55 G56 G57 G58 G59)

The lines above take the G codes from three groups.

  • G0 G1 G2 G3
  • G90 G91
  • G54 G55 G56 G57 G58 G59

It stores those values in #1 #3 and #14

So if the machine were in feed (G1) it would store 1 in #1

If the machine were in absolute (G90) it would store 90 in #3

And if the machine were in work offset G59 it would store 59 in #14

The four thousand system variable looks into the various G code groups.

Now Let’s Magic Them Back

Magic Back The G Codes

Restore The G Code Groups

At the end of the programme we have

G#1 G#3G#14

Which is the same as.

G1 G90 G59

This would depend on the state of the machines before you went into the macro.

So what we have done is restore the G codes back to their original values before we started tampering with them.

That way if the machine crashes you can say “look mate I never touched a thing”


CNC Milling G Code List For Beginners

CNC Milling G Code List

Download and print this nice large print CNC Milling G Code List

Download CNC Milling G Code List PDF

I always begin my training sessions by telling my students not to remember anything I say.

This sounds completely stupid and my excuse is it wasn’t my idea to say it.

About ten years ago I worked in France. After about a year and it seemed obvious that I would need to speak to people to order “Fish n Chips” and stuff like that.

Anyway I got these CD’s to teach me French and the bloke (can’t remember his name) started off by telling you not to remember anything he told you.

I think there is a bit of reverse psychology going on but the main idea is that you understand not remember. It didn’t work for me because I still managed to completely fuck up the language. Not realizing French Canadians speak differently to native Frenchmen (I was working for Bombardier) . Anyway I asked this bloke, in French, to “come with me”. I can’t remember what it is in French and after all the bloke on the CD had specifically told me not to remember.

Anyway turns out this had a sexual connotation and made me the complete laughing stock everywhere I went from then on. (I’ll let you do the maths on that one.)

“OK who bought all The fuckin toilet paper?”

When it comes to CNC Programming the idea of not remembering loads of G Codes is really important. Truth is you only need a few and it’s all about understanding what they do.

For Example I want to drill a hole.

You completed a training course at the CNC Training Centre. You understood it all and you practiced with you free simulation software that you get with the course.

You start writing a program to drill some holes.

From your training you know that there is a cycle that drills holes.

You understand how the cycle feeds the tool down to a depth and then it rapids out ready to do another.

Quick Fix G81 Video

You also know that if you keep adding more positions (X50. Y50.) it will keep drilling holes.

And… when you are sick of drilling holes there’s another G code to stops it.

What Are These G Codes?

So you just look em up on your CNC Milling G Code List.

G81 Drilling Canned Cycle
G80 Cancel Canned Cycle

Then you think “mmm I’m sure there’s one that pecks the material out and breaks it up”

“Let me see… Ah this looks like the one

G73                 Peck Drilling

CNC Milling G Code List

Type up or print this list in nice big letters and stick it to the side of your machine

Download CNC Milling G Code List PDF

CNC Milling G Code List

G00                 Move at Rapid speed
G01                 Feed in a Straight Line
G02                 Clockwise Arc
G03                 Counter Clockwise Arc

G04                 Time Dwell
G28                 Return Axis to Home

G41                 Cutter Compensation Left
G42                 Cutter Compensation Right
G40                 Cancel Cutter Compensation

G43                 Apply Tool Length Offset
G54 to G59     Work Offsets

G81                 Drilling Cycle
G73                 Peck Drilling
G83                 Deep Hole Drilling Cycle
G84                 Tapping Cycle
G80                 Cancel All Canned Cycles

G90                 Absolute Programming
G91                 Incremental Programming

Download CNC Milling G Code List PDF

WP to LinkedIn Auto Publish Powered By : XYZScripts.com