CNC For Beginners, Order Code
Category : Beginners
Running Order (CNC For Beginners)
This is part of a series of articles, CNC For Beginners.
The order of your code in one block does not matter from the computer’s point of view (see below).
The computer gobbles up a line or block of code and then makes sense of it. you programme G90 G0 X50. Y50. Z50. all the axis will move together so G90 G0 Z50. Y50. X50. would be exactly the same. I just jumbled it up, not to confuse you, just to show you that it does not matter.
O0001 (G81 DEMO)
(PROGRAMMER PETER ANDRE)
G21 G90 G40
(G90 G40 G21) Works the same
T01 M06 (20.0 MM DIA X 90 POINT SPOT DRILL)
(M06 T01) Works the same
G90 G0 G54 X12.64 Y88.0 S2546 M3
(S2546 M3 G90 G0 G54 X12.64 Y88.0) Works the same
However it is best to keep the order the same. Create your own convention and stick to it.
G90 G0 G54 X12.64 Y88.0 S2546 M3
If you programme as above you will get used to the order and your programmes will be easier to read.
At a customers recently I got really frustrated by the inconsistency of the program. I did the only thing my upbringing has taught me to do.
Headbutt the nearest object.
Consistency (CNC For Beginners)
G90 G0 G54 X12.64 Y88.0 S2546 M3
So you could begin with absolute or incremental (G90 G91).
Then rapid or feed (G0 or G1).
Then G54 (G55 G56…..) work offset.
Then X Y Z not Z Y X.
Then Speed S2546
Then turn on spindle M3
For example if the speed was always at the end of this line you would notice straight away if it was missing
It’s like reading telling the time we learn to recognise patterns.
So although the running order does not matter, in terms of the way the programme runs, it is important from a visual point of view.
Try to make your programmes consistent and to a regular pattern. Anyone using your programmes, including you, will find them easy to read and to fault find.
Remember if you are a programmer then the machinist, setters and operators are your customers so try and imagine the programmes from their perspective.
Heidenhain and Mazak
On these controls you don’t get any choice in the way the code is set out so you don’t need to worry. In fact you wasted your time reading this article.
Rules (CNC For Beginners)
I often say to customers that I work with that it does not matter how you do a lot of these things but you must have a consistent approach.
A good idea is to write a standard operating procedure (SOP) this would document exactly how the running order will be. If you are using CAD/CAM you will need to get into your post processor and make sure it outputs the code in accordance with your SOP.
Even down to leading zeros and training zeros do you programme G0 or G00 do you programme X.2 or X0.2. I know what I prefer because I hate wasting space (I am old school when memory space was sparse). It really does not matter but you must have a consistent approach and if you are not the only programmer, meet with your colleagues and come up with a plan.
If you don’t for example programme X50. Y60. Z80. in that order there is a good chance that you will alter the wrong figure and end up with two X figures or two Y figures.
Standardisation will mean less confusion and it will reduce errors.
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.
Services offered at CNC Training Centre
Classroom programmer 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.