Category Archives: Beginners

Leading Trailing Zeros CNC Programming Basics

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Leading Trailing Zeros

You do not need leading or trailing zeros in a CNC program (see below):

O0001(G81 DEMO)
G21 G90 G40
T01 M06 (20.0 MM DIA X 90 POINT SPOT DRILL)
G90 G00 G54 X12.64 Y88.00 S2546 M03
G43 H01 Z15.00 M08
G0 Z100.00
Z1.00
G01 Z-0.1
Without leading Zero is exactly the same. (Trust me it won’t self destruct or start world war 3)
O1(G81 DEMO)
G21 G90 G40
T1 M6 (20.0 MM DIA X 90 POINT SPOT DRILL)
G90 G0 G54 X12.64 Y88. S2546 M3
G43 H1 Z15. M8
G0 Z100.
Z1.
G1 Z-.1

Try to keep your code consistent. As I mentioned before try to make all programs look the same.

Create an SOP (Standard Operating Procedure) which will cover all programming layout options. Haas controls will insert their own leading and trailing zeros so you won’t have a choice there.

Leading Trailing Zeros and Memory

Leading Trailing Zeros, if you are short of memory (not as in forgetful) this can save loads of space, and you might be surprised how small the memory is on some CNC machines, some have the memory of a fish.

Leading Trailing Zeros

CNC Programming

The main thing is that you are happy with the layout of your program.

If you are not consistent with your approach it can cause a lot of problems.

Please remember that when you are typing code into the machine it will take you considerably longer to type G01 X0.200 Y0.200 F100.00 than G1 X.2 Y.2. It could wear out your fingers or give you multi RSI.

A Haas control will automatically add leading zeros but just try to ignore it. Maybe Mr Haas likes to see them.

Main thing is you don’t need to type them in.

Take a look at this article.

Another way to save space on a Mazak control is to delete all the spaces (ISO G code programs only)

Contact David :07834 858 407

Services offered at CNC Training Centre

CNC Programming Course

Onsite CNC Machine Training.

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.


Background Edit Fanuc

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Background edit, I only really get to hear about background edit when people get stuck in it. It’s a bit like being accidentally locked in a toilet you feel a bit of a twat and very embarrassed in equal measures.

This button is your closest friend

Now I made it real big because one day it will save your life.

You know when you play Monopoly and you get one of those cards that says “GET OUT OF JAIL FREE”

If you get sent to jail you just present this card and your sentence is immediately quashed it’s a bit like having Donald Trump as a mate.

It doesn’t work for shop lifting by the way I tried it as a child when I nicked a tin of Spam from the Coop. Fortunately in those days the police were never involved as they knew your parents would beat you to within an inch of your life at the slightest hint of petty larceny.

Anyway press this button background edit all your woes will cease.

And if that doesn’t work this one is the nuclear option.

background edit

The first one is for the program you’re actually background editing. Don’t forget you can have more than one program that you are background editing, more on this later.

Anyway this button stops them all, a clean sheet as it were.

Oh Dear

The reason people get into such a mess with this is because you can actually get into background editing by accident it’s easy.

If you are in a folder and you press INPUT then whatever program your cursor is on immediately comes up for background editing.

If you do this a few times then you can have several programs on the screen to edit.

 

You can switch between these programs and edit any one. You can copy and paste between them which makes writing programs from templates really easy.

Use the FORWARD and BACKWARD softkeys to switch between programs

To escape this lot you need the help of this key

background edit

This will end it all.

Background Edit is Amazing

Yes background edit is really useful, maybe amazing is stretching it a bit, but it does have many uses. Editing a few programs together is the bit I like.

If you want to edit whilst you are running a program then that’s also useful.

Background edit Warning

Don’t hit the fuckin reset button!!!!

Obviously this will stop everything so why would you do it?

Well maybe you are one of those very naughty boys who uses it to get to the head of the program when editing.

When in background edit it’s easy to press reset except this time you just stopped everything because your program is running.

Change Your Habits

Use rewind, some controls have a rewind button

use this to get to the head of the program.

On other controls it’s LINE SEARCH then press TOP or BOTTOM

This will take you directly to the head of your program or the end of your program.

Nothing is stopped and no one is harmed.

background edit

 

Why I Hate Background Edit

It’s an absolute pain in the bollocks mainly because it is so easy to accidentally get into background edit and not even realise.

You keep pressing the MDI button and the screen just wont change. If you have Guide i then you will get a warning when you switch over and you can’t do anything until you end it.

To be honest I don’t hate it at all. You just need to be aware that you need to come out of it to do various other things.

Another Useful Feature

If you want to use a program for reference. In other words you want to look at what’s in it but you need to be careful not to alter it.

Press BG EDIT then type in your program number

Press REF EXEC

Your program will appear in green meaning it is “read only” so you can’t accidentally alter it.

What’s Running in The Background?

You can also call your running program in background edit. This will also appear in green and be read only.

 

 


Ten Things You Might Not Know About The Fanuc Sub Program

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Sub Program Fanuc

Here are ten things you might not know about Fanuc sub programs,

Fanuc CNC controls are the most common controls in the world so it might be useful to have a good understanding of how sub programs are called and used.

(1) You Can Call a Sub Program By Name.

Yes you heard it here the program can be called by it’s name or it’s number. When calling by name don’t use the P.

Just put the name of the program in these things <> with an M98 and your away.

M98<ALBERT>

The only problem with this is that the syntax needs to be spot on so if you have got complicated names for your your sub routines then you might be in the shit.

I always call mine names like ALBERT that are easy to remember.

(2) You can use internal sub routines on a Fanuc Control.

Some people call these local sub programs. It just means it’s tagged on the end of your program which makes them nice n easy to look after. A bit like a pet Goldfish or a pet fly.

I bought mine from the local pet store. I asked the assistant if he sold pet flies and he said no. I said “well there are loads in the window”.

Anyway he sold me one (£15) his name is Paul

 

This is not him this is Steve.

Internal Sub-Routines

By typing M98 Q500 your control will look for N500 within your current program. This is great because you can add the sub programs to the end of your main program. Don’t forget to leave big gaps so you can clearly see where and what they are. Oh and mind your P’s and Q’s.

M98 P500 (Call O500 externally)

M98Q500 (Call N500 in main program.

Oh and read this too.

Sub Program

Just one other thing. Watch your n numbers it’s easy to get them mixed up. Try and use a convention.

“Read More”

Fanuc Editing Copy and Paste

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Fanuc Editing Oi Model D. This does vary on the age of your control this article is for a newer control (Fanuc Oi Model D).

Read this article if you want to see Fanuc Editing 18i (older control) or this one for older Oi control  copy and paste.

Now I’ll warn you that it’s not a simple process but if you get into the habit of using it you’ll never leave home without it.

I am definitely not going to rant on and on about why all these simple procedures were not introduced years and years ago. Why has the editing on CNC controls generally been so shit over the years?

I am also not going to rant and and whinge about how fuckin complicated it all is.

I mean bloody hell all I want is to take this shit here and join it to the end of this shit here.

I’m not asking  for an “X Factor Audition Here” (Simon if you are reading this my contact details are above) I only write this crap to try and make some money, my really passion is singing and exotic dancing in my underwear. I really want this Simon, just one chance is all I need.

“Read More”

Checking CNC Programmes

Category : Beginners

Prove-Out, Without Tears

I am always amazed when I watch people Checking CNC Programs or proving out as it is sometimes known.

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

Even experienced machinists with years of experience often do this completely wrong. It really can be done without crashing the machine.

Checking CNC Programs

What You MUST NOT DO When Checking CNC Programs

  • Don’t allow anyone to stand over you especially if it makes you nervous tell the boss to piss off.
  • Never ever rush this process.
  • Always carry out all the checks below before you prove out.
  • Don’t cut corners.
  • Never take off machine interlocks or override any kind of safety device.
  • Do not prove out your program when you need the toilet.

Have a Plan

It sounds stupid but what will you do if something goes wrong when you’re Checking CNC Programs.

Do you remember when you first drove a car?

The first emergency stop you did?

Well you didn’t automatically hit the brakes and depress the clutch did you? You had to think.

I thought these gloves made you drive better

When you are an experienced driver, in an emergency you will automatically  hit the brakes. This is because a path is permanently etched on your brain and it’s almost an involuntary action.

This is the same with a CNC Machine if you are used to hitting the E Stop button then it will come automatically.

This is often called “muscle memory” which incidentaly is a complete misnomer. Muscles don’t have memory.

A bit like me there are loads of things I don’t remember. My wife recons when I came home the other night completely bladdered that I urinated in the wardrobe before eating the contents of the dog bowl.

As far as I’m concerned it never happened.

If you are like me, working on lots of different CNC Machines almost everyday, then you really don’t have a clue where the Emergency Stop Button is.

I still can’t remember which drawer my fuckin socks are kept in let alone the complex layout of 100 different CNC Machines.

The Plan For Checking CNC Programs

It’s easy, if you are new to the machine and you have any doubts at all, hold your hand over the Emergency Stop Button. Then in your mind think “one false move and you get it sucker”.

Pressing the E Stop button doesn’t start world war three but what it will do is halt everything instantly.

Big machines are the exception to this rule

Checking CNC Programs

The more metal swinging around the harder it is to stop. On these machines it’s probably best to just go into a blind panic and run off.

After hitting the E Stop you may have to go through your machines start-up procedure. You may even have to get a boring bar out of a tight spot but you didn’t break anything did you. That’s the idea.

So to use the car analogy. You think…..
  1. Press brake and clutch.
  2. Control the car.
  3. You can panic now (it’s over you didn’t kill anyone)
So do the same with your machine…
  1. Press the Emergency Stop.
  2. Mmm, there is no number 2

Obviously your plan will not always be to hit the E Stop. This would be a very short blog if that’s my only advise.

Checking CNC Programmes

You may just want to press Cycle Stop or the Feed Hold button.

Checking CNC Programmes

The main idea is that you are covering the button you’re about to press. This keeps things really simple, the way I like it. In a panic you won’t have a clue where the button is.

Checking CNC Programmes

The System When Checking CNC Programs

When Checking CNC Programs (proving a program) you should either be looking at the program with the machine stopped or, looking in the machine whilst it is running. You can’t do both at the same time so….

  • Stop the machine and look at the program.
  • Start the machine while you’re looking inside with your finger ready to feed hold or E stop.

Dry Run

Most machines have a Dry Run Button or switch. Personally I never use them. Dry Run gives you a feed control over both rapid and feed moves and it does depend on parameter settings as to how it works.

It means that you can control all your moves with the feedrate potentiometer.

Sorry for being posh a potentiometer is the dial thingamajig. Say it in front of the boss and if you get a pay rise I want a percentage.

Checking CNC Programmes

Anyway try it and see what you think, (dry run that is). Your machine parameters will give you the option to override rapid moves or not.

OK so why don’t I like dry run?

That’s an easy one.

When using dry run it is easy to get carried away and feed really fast on a rapid move but don’t forget when you come to the next feed move you are probably feeding way too fast and you will break the tool.

Yes you have guessed it I have done that on a few occasions.

On some controls Dry Run will stop the spindle from running so it has to be run in fresh air with no part in the machine.

Rapid Override

Buttons or dials, you can override all rapid moves by a percentage.

Checking CNC Programmes

On some of the Heidenhain control panels the override works for rapid and feed moves so you just have one control.
Checking CNC Programmes

Beware because some controls have a massive difference between the slowest and the next setting. It’s either like watching paint dry or shit off a stick.

Checking CNC Programmes

Machine Lock

You can use the machine lock which does as it says. Nothing moves so it is purely for testing the code. All the positions etc will change so you will see everything moving on your position display but the axis are locked.

CAUTION

On some older machines the machine will completely lose its position and you will need to zero return after using this. It’s what’s known as a shit storm.

Personally I think it’s a waste of space. Unfortunately on some controls you have to use it to run the graphics so you have no choice.

If at this point you are thinking “what the fuck”. I totally agree don’t get me started on graphics.

MST Lock

If you use this let me know cos I don’t know anyone who does. It effectively locks all M Codes all S Codes and all T codes.

So:

  • No coolant.
  • No spindle start.
  • No tool change.
  • Etc Etc

Running The Program 10 Foot Above the Part

Again not something I do. Some people like to run the program above the job (in fresh air). Or on a lathe away from the chuck.

The only problem is you still won’t be sure the program is OK when you do it for real. Anyway do it if you want I won’t ban you from my website or anything.

If you must do this it’s best to put a figure in the external work offset as below.

This means your program will run 100mm above your Z datum.

Don’t forget this shifts all your offsets so you need to proceed with caution,

You are very likely to forget to put this back. Even worse you may alter the wrong figures.

The long term solution is to put this line of code in every program which will reset it, you might want to put a block skip too so that you can skip it when you test the program.

Graphics

If you got em use em. A lot of, in fact all, machine graphics tend to be complete dogshit.

It is not like a CAM system such as Edgecam where you can completely collision check your program.

Don’t forget it’s a good way to pick up coding errors and you will see if you drilled a hole miles out of position.

We are looking for the big hitters here, big mistakes.

Checking CNC Programmes

You definitely won’t know if a hole is a mm out of position but that is not really the idea. Read this article.

The Dangerous Bits When Checking CNC Programs

The most dangerous part in any program is when each tool first comes down to the part.

Why?

Because that’s when you apply the tool length and the work offset. Both of these can be wrong.

The second most dangerous time is when the tool leaves the part and goes back to tool change position.

Before You Start, Be Patient Tiger

Let’s do a checklist Before Checking CNC Programs Out
Milling First.
  1. Check datum in MDI. Move your machine to X0 Y0 in your work offset as a test. You can test the Z too but be careful.
  2. Does every tool have its length set? If you use proper tool lengths in your offsets then as a rough guide you can manually measure each tool with a steel rule as it comes out.
  3. All tools using G41 G42 compensation will need their radius or diameter setting in the offset file. (Here is a video on G41 G42 if you are unsure)
  4. On Fanuc type controls make sure the T and H codes correspond. On a Haas Machine this can be automatically checked by changing a setting and it will give an alarm (Setting 15).
  5. Also on Fanuc type controls make sure your D offsets are correct.
  6. Check the first movement line of each tool it should contain G90 absolute and the Work offset.
  7. Try to always make your programming format the same. That way you will easily spot mistakes. Read this article on well set out CNC Code
  8.  Learn about modal G codes. Make sure the first feed move has a G01.
  9. Clean all your screens and make sure you have the best view possible.
    Now Turning.
    1. Check work offset in MDI send a tool to Z0.
    2. Does every tool have its X and Z offsets set?
    3. All tools using G41 G42 compensation will need their radius and virtual nose position set. (Here is a video on G41 G42 if you are unsure)
    4. Check your tool change position is adequate to clear every tool. A sub-programme is useful for storing this as you only need to get it right once. And don’t forget that the turret will spin around here. Make sure it can’t hit anything.
    5. Remove long large tools if not in use.
    6. Check that each tool calls its offset T0101 (Tool one offset one).
    7. Check the first movement line of each tool.
    8. Try to always make your programming format the same. That way you will easily spot mistakes. Read this article on well set out CNC Code
    9.  Learn about modal G codes. Make sure the first feed move has a G01.
    10. Make sure you have a G50 speed clamp. Read this article to see what happened when I missed it out.
    11. Clean all your screens make sure you have the best view possible.

Here’s A Thought

If your rapid is nice n slow even if you hit the part with the tool as it approaches the workpiece:

  1. I probably won’t break the tool.
  2. If it cuts the metal, so what.
  3. You will have time to stop it.
  4. You probably wont get fired.

Most controls have a check screen so use it

How we Teach Checking CNC Programs (Prove Out) at The CNC Training Centre

  • You might want to reduce spindle speed for the prove out it feels less stressful.
  • I don’t start the spindle until the tool gets to the workpiece. That way there is a lot less drama.
  • Set rapid override to minimum.
  • Set position screen so that you can see the distance to go or remain. You must be able to read the program (a printout may be useful).
  • You need to be able to view the modal G codes as well as spindle RPM. All controls will have a screen to show this along with loads more useful shit.
  • If you have a set-up key then use it. It will allow you to do more things such as opening the door at low RPM.
  • Check your manual to know exactly what you can and can’t do when you stop your program. This varies massively between machine tools.
  • Set your Optional Stop switch or button to on. If you have M01 before or after each tool then the machine will stop.
  • Set single block to on. This is a button or switch. This means for each block of code  (line ending in ;), the machine will read it, do it and wait.

Single Block

If you try and prove out a program with single block off you will get to the end of a block and the machine will carry on.

This often causes operators to shit themselves as they are not ready for what ensues. Keep single block on and you will only have to worry about the block you are doing.

Sometime in a CNC program there is a load of bollocks going on in the background that you can’t see. Something like a tool change may be reading loads of blocks you can’t see and are of no interest to you.

A quick work around on this one is take the machine out of single block

Set rapid and feedrate overrides to zero. Press cycle start and just wait around for some shit to happen.

Look at your display and as soon a the machine shows a distance to go or starts to move press the feedhold button.

Now you can switch the single block on and proceed with your prove out.

Checking CNC Programs

So here we go…..

  1. Rewind and Reset the program to the beginning. Best done in memory with rewind button.
  2. Press cycle start as you look into the machine. Be ready to press Feed Hold or Program Stop button.
  3. If your rapid is set nice and slow it’s OK to switch off single block until the machine starts to move. As soon as it does press Feed Hold and turn Single Block back on. This may be necessary if your tool change program (which is not normally visible) allows single block. This means just a tool change will require loads and loads of presses of the button.
  4. Watch as the tool gets closer to the workpiece. Press feed hold when it is close to the workpiece. (It may stop before this).
  5. Now read the program.
  6. Look at the remaining distance to go. If this is a massive number it’s time to panic.
  7. Now work through each block like this.
  8. Stop the machine and look at the program. Read the position display. Start the machine while you’re looking inside with your finger ready to feed hold or E stop.
  9. When you have completed the Prove Out run the program without single block but still keep the rapid nice and slow.
  10. After a few parts you can put rapids up to maximum.

Video below shows how to use REWIND in Auto mode.

Remember when the machine is moving you should be watching not looking at the display. Only look at the display when the machine is stopped.

I could say good luck but I would never expect you to rely on luck. Be patient and follow the above and you wont need it. As Louis Pasteur said luck favors the prepared mind.

Thanks for reading this article and don’t forget the most important thing is your personal safety and the safety of others.

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