Modal and non modal G codes

Modal and non modal G codes

CNC Training Call David: 07834 858 407

30 Five Star Reviews

CNC Training Centre Reviews

Contact CNC Training Centre

 

Modal and non modal G codes

Modal and non modal G codes

Let Me explain

We all know that programming can be complicated. So let me explain to you how it all works. This article explains the real meaning of Modal and non modal G codes.

Modal means that once a command is issued it stays in the control.

How Can you Actually Use This?

If you issue a G0 or G00 command the machine is in rapid and you do not need to re-state it.

Rapid means all motors are flat out, like a teenager in a Ferrari.

Every move from then on will be a rapid move unless you tell it otherwise. The G code that changes it must be in the same group. For example G0 G1 G2 and G3 are all in the same group a bit like The Beatles used to be.

The other day I was talking to  a “young person” who hadn’t even heard of the Beatles. I mean fuckin hell, am I really really old or are they doomed to be forgotten?

“Read More”

Tool Length Offsets Beginners CNC

CNC Training Call David: 07834 858 407

30 Five Star Reviews

CNC Training Centre Reviews

Contact CNC Training Centre

 

This article will explain all you need to know about tool length offsets and setting tool length offsets Fanuc

Ok so you managed to write a CNC Programme for your CNC Milling Machine, well done.

A CNC program is a set of instructions telling your CNC Machine exactly how to machine your component.

It contains all the necessary tool paths XY position and Z depths.

It also contains on off signals to do things like starting the spindle (M3 clockwise M4 counterclockwise).

The progam will have all the feeds and speeds for your tools. You may have performed a simulation using the graphics on your machine.

 

tool length offsets

Lots of software like Edgecam can perform full collision detection. You have a model of every tool and it’s holder. There is full model of the machine and all the work-holding.

tool length offsets

Edgecam will even tell you if the flute length of the tool is too short!

Ok so that is all great so far but when we put this program in the machine to run there are three things the machine doesn’t know.

Can you guess what they are?

No it doesn’t know jackpot winning lottery numbers (that would be four things it didn’t know).

  1. It doesn’t know where the part is in the machine coordinate system.

  2. It doesn’t know how long the tools are (tool length offsets).

  3. It doesn’t know the diameter of the tools.

Vital information wouldn’t you say?

So first of all we use the Work Offsets to tell the machine where the part is.

Read this for more CNC Help if you want to learn how Work Offsets are used.

Please don’t worry if you don’t know how to do this after all this is beginners help with tool length offsets .

Your mates don’t know your reading it, you can tell them you already knew all this shit.

tool length offsets

So in the picture above we would touch the spindle nose onto the Z datum of our work-piece. This would tell the machine where the part is in the Z axis.

 

tool length offsets

 

This distance is input into our work offset table (in this case G54).

If we now program G0 G54 Z0 the spindle would rapid down to this position (G54 is where the values are stored).

We wouldn’t do this by the way cos the machine would crash.

tool length offsets

Now The Tool Length

What we now need to do is take into account the length of the tool.

We would measure each tool length and store it in our tool length offsets file.

tool length offsets
This is how they look on a Haas Machine

This tool length offsets file stays in the machine and is independent of your CNC Programs. So now any program can access this file.

So how does it do that?

It uses G43 and G43 says “ok get me a tool length offset”

G0 G43 Z3. H1

Which tool offset?? Well that’s the H number.

So the line above says to the machine rapid to Z3. Oh and by the way allow for the length of Tool 1 before you get there.

That’s the H1

So it gets the tool length from the tool length offsets file. It then does all the maths for you.

Actually it’s just a bit of simple arithmetic. Your (G54) work offset) minus your tool length.

Your tool will arrive 3mm above your component.

So whatever tool you called into the spindle with your M6 command you need to use the corresponding H number.

M6 T5                                                  (Get tool 5 in the spindle)
G90 G0 G54 X0 Y0 S1500 M3    (Rapid to X0 Y0 and start the spindle)
G43 Z3. H5                        (Rapid to Z3. but allow for the length of tool 5)

How do you measure the tools?

tool length offsets

Well some people use a bit of paper!!!

And some buy one of these little babies.

“It’s just a light on a fuckin stick” I hear you say. But it’s so much more. I comes on at an exact distance above your part. And because it’s all spring loaded, if the tool carries on a bit it don’t bust anything.

Only cheap but do a great job.

setting tool length offsets fanuc

And if your a very good boy you might get one of these for Christmas.

tool length offsets

Auto tool measurement (yes it’s all done for you)

In the cases above we are storing the actual tool length in the offset file.

Now let’s take a look at that tool file again.

tool length offsets

Some of my readers are very astute but before you start writing me an email or commenting on this article. “oh David it looks like you fucked up again”

I know……

Why are the tool lengths (Under Geometry) minus figures?

That’s because as always there are several ways to do this. What some people do (and I am not one of them) is……

They bring each tool down from zero return and touch on the part. This figure is then recorded in the tool length offsets file. And yes it’s a minus figure. Of course the G54 work offset would be zero in the case of Z.

tool length offsets

 

Now I am not prepared to argue with you about this (your doctor told me not to). It’s just bad.

Maybe you might want to read this?

That figure has no relation to the actual tool length and you need to reset every tool for every Job!!

I’m saying no more I’ll just wait for the comments.

There is Only One Way

Actually there is something else to consider. (I know I
said I’m saying no more).

By setting your tool length the correct way (my way), the stored offset is the actual tool length and you can do a rough check with your steel ruler before proving your program.

Auto tool length measurement will always give actual tool length and so will a tool pre-setter. That means you can swap tools between machines.

A Few Other Things About Tool Length Offsets

If you have a Mazak. Mmmmm if you have a Mazak.

Well it’s easy. Mazak machines have active offsets so the minute you do a tool change and get your tool in the spindle the tool lengths offsets are active. They also nearly always have an auto tool measurement system

.

Sorry if you are a Mazak user and you are thinking “this dozy bastard has made me read all this gratuitous shit for nothing”

Now’s the time to leave. Go on off you go.

Ok so what.

Mazaks also do this…….

When you write a G code type program for a Mazak you don’t need a G43 and you don’t need the H

M6 T5                                                  (Get tool 5 in the spindle)
G90 G0 G54 X0 Y0 S1500 M3    (Rapid to X0 Y0 and start the spindle)
Z3.                        (Rapid to Z3. but allow for the length of tool 5)

Forget the G43 H5 shit…. soooo easy.

Those Mazak guys just don’t believe in stating the obvious and wasting your precious finger tips typing in a load of bollocks that the machine should know anyway.

Just remember you can change this by parameter if you want it to work the same way as your Fanuc or your Haas. Oh and you don’t care about increasing your carbon footprint with those extra finger presses.

That way you can put programs from your Fanuc into your Mazak and vice versa.

One other thing

 

Haas have a little trick up their sleeve.

You can alter the settings on a Haas machine so that if your H and your T are not the same you get an alarm.

M6 T5                                                 
G90 G0 G54 X0 Y0 S1500 M3   
G43 Z3. H1                       

Remember our program. If you changed the tool number but forgot to change the H you would be using the length of T1 for T5

 

 

Yes you just bent your machine.

Of course if it’s a Haas you just get an alarm.

Learn all this and more

 


G80 G-code Fanuc

CNC Training Call David: 07834 858 407

CNC Training Centre Reviews

Contact CNC Training Centre

I noticed a common search in google is G80 G-code Fanuc.

CNC Machines use what we call canned cycles in a nutshell G80 cancels a canned cycle.

What is a canned Cycle?

To be honest I think it is a funny choice of words “Canned Cycle”.

My guess would be that all the information to drill a hole would be kept together in a “Tin Can” to use whenever you want.

I made this…….G80 G-code Fanuc

First of all we program the cycle this is a G81:

G81 G98 Z-10. R1.5 F200. X55. Y55. F250.

The machine will move to the position X55. Y55. then it will rapid to 1.5mm above the part (this is the R1.5). It will then feed down to Z-10. at a feed-rate of 250 mm per minute F250.

Finally it will use rapid to come out of the hole.

It then sits ready for the next move.

 

All you do now is just give more positions.

G81 G98 Z-10. R1.5 F150. X56. Y56. F200.
X70.
X85.
X90.
X95. Y65.
G80

Every time it moves to a position it will do whatever you stated in the canned cycle (G81)

You don’t add anything else to these positions.

G80 G-code Fanuc

“Read More”

Fanuc Display – Relative Position

 

CNC Training Call David: 07834 858 407

30 Five Star Reviews

CNC Training Centre Reviews

Contact CNC Training Centre

 

Fanuc Display (Relative Position) is used only by the operator.

Fanuc Display

You can reset Fanuc Display (Relative Position) just like you would on a manual machine with a DRO. So use it for setting or even measurements. One thing to remember is it will not retain it’s position when you turn the machine off. The control in the video is a Fanuc 18i on a big vertical lathe but all other Fanuc controls are similar.

Subscribe to my YouTube channel (I beg you)

“Read More”


Cutter Compensation

CNC Training Call David: 07834 858 407

30 Five Star Reviews

CNC Training Centre Reviews

Contact CNC Training Centre

Cutter compensation explained.

This is a video explaining cutter compensation in CNC programming.

You will come across various terms to describe this such as:

  •  Tool cutter comp.
  •  CNC cutter comp.
  •  G41 G42 cutter compensation.
  •  Cutter diameter compensation.
  •  Cutter radius compensation.
  •  Heidenhain RL RR.

Cutter compensation is referred to as cutter diameter compensation and cutter radius compensation

Haas cutter compensation, Fanuc cutter compensation and Mazak cutter compensation all work in the same way.

Although Heidenhain cutter compensation or Heidenhain cutter comp looks different. In the programme it functions in exactly the same way.

Cutter Compensation

In the parameters or settings of your control you can set up your system to use the radius or the diameter of your cutting tool.

This means that when you input the data for your cutting tool in your offset table you can use the diameter or the radius of the tool.  This depends on your settings.

Cutter Compensation

When people talk about cutter compensation G code they may say “cutter comp G code” it’s often shortened.
(Cutter compensation G code)
The G codes used in this video are:

  •  G41 cutter compensation left
  •  G42 cutter compensation right
  •  G40 G code to cancel cutter compensation

This Video shows you :

  • How to program G41.
  • How to program G42.
  • CNC cutter compensation examples.
  • Cutter compensation Heidenhain style.
  • Heidenhain RL RR.

We always recommend that you climb mill so you will be using G41 most of the time.

Milling the outside of a square using G41.

Cutter Compensation

Milling the inside of a square using G41.

Cutter Compensation

Milling the inside of a square using G42 (should you want to conventional mill).

Cutter Compensation

Milling the outside of a square using G42 (should you want to conventional mill)

Cutter Compensation

 

The rules when using compensation on a CNC Milling machine.

Rules are the same as the tool nose radius compensation on a CNC Lathe.
If you programme a shape and you do not use cutter compensation you will have to work out the size of the shape with your tool radius added.

This is simple on a square sided figure or a simple radius. Anything more complex and it’s a nightmare.
I just heard some smart arse say “Ah well my CAD system takes care of that”.
So it should my friend but, and there is a but:

  • What will you do when your cutter wears?
  • What if you want to use a different size cutter?
  • The cutter may not run true.
  • What if the cutter is not exactly size?

In the old days of paper tape and Corned Beef we as programmers would write several programmes.

This was so that we could re-grind the milling cutters in fixed increments. A different programme could be used each time the tool was changed.

Sorry I can’t talk about this much longer as I still have the nightmares (mainly about corned beef sandwiches).

Cutter Compensation

 

Anyway enough of that. So when we machine our first profile we can add some on to the tool radius in the offset file. When we check the part we can adjust the offset and re-cut the profile to achieve an accurate result.

The Rules:

  • Shape must be continuous and consistent.
  • You can’t cut along a line and then go back along it.
  • It’s important to allow more than the tool radius when entering tool compensation. The same applies when you come out of tool compensation.
  • Internal corner radii and steps must be greater than the tool radius.

Always allow more than the radius because when you adjust it it may be larger than the actual tool you are using.

Don’t ask

For example if you have a 12mm endmill but you have .2mm in the wear compensation. The machine thinks that the tool is 12.4mm in diameter.

You can’t do this in cutter comp:

Cutter Compensation

You would have to apply one cut in G41 and cancel with G40 then do another cut in G42 and cancel with G40:

Cutter Compensation

Call 07834 858 407

Please contact me if you require:

  • Fanuc training.
  • CNC programming training.
  • Want to Learn CNC programming.
  • Fanuc programming   training.
  • Yasnac programming training.
  • Any type of CNC course.

Don’t forget to watch my Tutorial Videos

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.


Careers in CNC

View all current vacancies in CNC

Click here

Call David: 07834 858 407