G Code Groups What Use Are They?

G Code Groups What Use Are They?

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.

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.

Here is a list of G codes and the group 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 opeator just incase he types in bollocks instead of an R number or some such thing.

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

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

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 out.

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

The macro program 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)
M99

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

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

So when you program M6 you get program 9010 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.

G28 G91 Z0 (THE EVIDENCE)

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 responsibilty for the G code 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 programs.

Anyway what shall we do about it?

We Do This

09101(TOOL CHANGE MACRO)
#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)
M6

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

OK What’s Going On Here

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

#3=#4003(STORES G CODE GROUP 3)
(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 goups.

Now Let’s Magic Them Back

Magic Back The G Codes

Restore The G Code Groups

At the end of the program 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


Repeat Canned Cycle Using L and K

Category : Fanuc Mill Haas Mill

Repeat Canned Cycle

Repeat Canned Cycle, here is a simple G81 canned cycle.

O001 (Drilling Program)

T1 M6 ((10mm Drill)

G90 G0 G54 X50. Y50. S1500 M3
G43 Z3. H1 M8

G81 G98 Z-15. R1. F200.
X60.
X70.
X80.
X90.
X100.
G80

G0 G53 Z0
G53 Y0
M30

Now here is the same program in incremental.

O001 (Drilling Program)

T1 M6 ((10mm Drill)

G90 G0 G54 X50. Y50. S1500 M3
G43 Z3. H1 M8

G81 G98 Z-15. R1. F200.
G91 X10.
X10.
X10.
X10.
X10.
G80 G90

G0 G53 Z0
G53 Y0
M30

Both programs do the same thing now lets shorten the last one.

Repeat Canned Cycle L5 or K5

O001 (Drilling Program)

T1 M6 ((10mm Drill)

G90 G0 G54 X50. Y50. S1500 M3
G43 Z3. H1 M8

G81 G98 Z-15. R1. F200.
G91 X10. L5
G80 G90

G0 G53 Z0
G53 Y0
M30

(This would be K5 on a Fanuc control)

Now you have to admit that’s easy.

For all you “incremental deniers” come on now, this saves a lot of code.

And……

if the distance between the holes was 10.236 imagine having to add them all up.

Anyway that’s another argument for another time.

Repeat with No Repeat !!!

This article is about iteration. Which is just bullshit for “how many time you do it”.

In other word the L5 or K5 means do it 5 times.

You can also use L0 or K0 which means do it zero times (don’t do it).

O001 (Drilling Program)

T1 M6 ((Spot Drill)

G90 G0 G54 X50. Y50. S1500 M3
G43 Z3. H1 M8

G81 G98 Z-5. R1. F200. L0
M97 P500 (Go to drilling sub program)
G80
G0 G53 Z0

T2 M6 ((10mm Drill)

G90 G0 G54 X50. Y50. S1500 M3
G43 Z3. H2 M8

G81 G98 Z-15. R1. F200. L0
M97 P500 (Go to drilling sub program)
G80
G0 G53 Z0
G53 Y0
M30

N500 (Drilling Sub Program)
X50. Y50.
X60.
X70.
X80.
X90.
X100.
M99

What this means is you set the canned cycle up so the control know what you want to do. Because of the the L0 or K0 it does not actually drill a hole.

When it goes into the sub program it’s business as usual and it drills all your holes.

All your positions are self contained in the sub program.

Now it’s time for one of my famous, very boring stories.

Go here, this guys videos are way more interesting than this shit.

The Boring Story

Years ago when I worked at SP Engineering in Barwell. We used to make parts for knitting machines.

We made this part which was a massive plate covered in all different sized holes. Drilled tapped bored you name it. It was like that cheese that has all the hole in it. Well not really but you know what I mean.

We used to get a spot drill and just dot the plate all over. We then put the part into inspection where they used a CMM (coordinate measuring machine) to measure all the positions of the dots.

 

 

The probe just drops neatly into the spot drilling dots.

Also because each set of holes was in a sub program they could be reused once the positions were OK.

 

It is a useful method because once the sub program is used you know all the positions are correct for any subsequent tools. It makes prove out much easier.

Using L0 or K0 to Get Round Corners

This is a novel way to use L0 to get round the corner of a part.

L0 for a Haas control K0 for a Fanuc control.

Repeat Canned Cycle

 

 


G84 Rigid Tapping Program Example

G84 Rigid Tapping Program Example

G84 is a tapping canned cycle.

G84 taps holes.

This simple part has four M12 holes, drilled, countersunk and tapped. The datum is the centre of the part so the holes positions are.

X55. Y55.
X-55. Y55.
X-55. Y-55.
X55. Y-55.

G84 Rigid Tapping Program Example

G84 Rigid Tapping Program Example

Here is the CNC code

G84 Rigid Tapping Program Example

The machine first moves to X-55. Y-55. and rapids the Z axis to 3mm above the part.

G84 Rigid Tapping Program Example

The G95 selects feed per revolution which means we only need to program the tap pitch for the feed-rate.

See full rigid tap G84 Rigid Tapping Program Example

The M29 engages the rigid tapping mode and the S800 is the speed. (It does not start the spindle)

It then rapids the Z axis down to 1mm above the part R1.

The G84 Cycle instructs it to tap a hole 17.mm deep (Z-17.) at a feed of 1.75mm per revolution (F1.75) 

So it feeds at 1.75mm per revolution with the spindle turning clockwise to depth.

At the bottom of the hole it reverses the spindle and feeds back to the initial point.

This initial point was in the line.

G84 Rigid Tapping Program Example

This is because of the G98.

If it were G99 it would return to 1mm above the job (R1.)

See explanation of G98 and G99

Once the cycle is active each time it sees a position it repeats the tapping process.

When the G80 is programmed it no longer taps holes.

Single block and feedhold do not work in a tapping cycle.

Why? You ask.

IT BUSTS THE TAP

Now watch the video to see it all in action (not breaking the tap).

Thanks

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

If you want to learn to program CNC Milling Machines

Look no further Contact CNC Training Centre

 

 

 


G82 Drilling Program Example

G82 Drilling Program Example

G82 Drilling Program Example, this simple part has four M12 holes drilled countersunk and tapped.

The datum is the centre of the part so the holes positions are.

X55. Y55.
X-55. Y55.
X-55. Y-55.
X55. Y-55.

G82 Drilling Program Example

Here is the CNC code

G82 Drilling Program Example

The machine first moves to X-55. Y-55. and rapids the Z axis to 3mm above the part.

It then rapids the Z axis down to 1mm above the part R1.

The G82 Cycle instructs it to drill a hole 6mm deep (Z-6.) at a feed of 200mm per minute (F200.)

When it gets to depth the P3000 tells it to dwell for 3000 milliseconds which is 3 seconds. No decimal point allowed. (Varies on controls)

When the hole is done it rapids back to the initial point (Z3.) This was in the line

This is because of the G98.

If it were G99 it would return to 1mm above the job (R1.)

See explanation of G98 and G99

Once the cycle is active each time it sees a position it repeats the drilling process.

When the G80 is programmed it no longer drills holes.

Now watch the video to see it all in action.

G82 Drilling Program Example

Haas G82 example

It’s been great fun writing this article for you but to be totally honest i think this cycle is a complete waste of time. Whenever I have put a dwell in a spot drilling cycle it always seems to chatter.

However if you do use this cycle please let me know if you have success with it.

Thanks

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

If you want to learn to program CNC Milling Machines

Look no further Contact CNC Training Centre

 

 

 


CNC Training Centre
WP to LinkedIn Auto Publish Powered By : XYZScripts.com