CNC Programming Running Order

CNC Programming Running Order

CNC Programming Running Order (CNC Basics)

CNC Programming Running Order

CNC Programming Running Order, the order of your CNC code within one block does not matter (see below)

Or does it?

O0001(G81 DEMO)
G21 G90 G40
(G90 G40 G21) Works the same
(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

So if you always put the speed and M3 (spindle start clockwise) at the end of the first position line try to always stick to that.

It Could Save You

If one day you miss out the speed for example. You will look at the code and it will look strange. You will immediately realise what is wrong.

It’s like the time my cooker got pinched, I looked in the kitchen and their was an old pince of cheese and a dirty floor where it used to be. Whilst I was thinking of a recipe to use the old cheese in I thought “something is wrong”.


You will get used to the order of your programs and they will be easier to read, so the CNC Programming Running Order is important.

This helps not only you but your customer, the machine operator or setter.

CNC Programming Running Order

Imagine you have not seen this program for a while. How long will it take you to realise how it works and what it does?

When you look at any code that I write, in any of my articles, I always use extra end of blocks to space out the code.

Compare CNC Programming Running Order to paragraphs in a book, that is how we visually can jump around the pages.

If for example you were looking at an old program,  you would quickly be able to scan the program and see what’s going on.

So although the order does not matter to the machine it matters to you, try to make your programs consistent and to a regular pattern.

Anyone using your programs, including you, will find them easy to read and to fault find.


  •  Try to keep XYZ in that order to save confusion.
  •  Make your first three or four lines of each tool always follow the same pattern.
  •  Turn on the coolant in the same place (if it’s not there you will notice).
  •  Start the spindle in the same place and the same when you switch them off.
  • Produce an SOP (Standard Operating Procedure) documenting program layout.
  • Bunch code together in meaningful blocks.

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

Services offered at CNC Training Centre

Edgecam training.

Classroom programmer training.

Onsite CNC Machine Training.

Siemens Sinumerik 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.

Log out of this account

Leave a Reply

WP to LinkedIn Auto Publish Powered By :