Well Set Out G Code CNC (CNC Programming)
Category : Fanuc Haas Useful Stuff
Well Set Out Code
Contact David 07834 858 407
Well Set Out CNC Code is really important. It can save lots of time spent trawling through code trying to find the section you’re looking for. Simple things like leaving gaps after the tool change line can really help.
The program runs exactly the same but……
Look at the two examples of the same program
Well Set-Out

Not Well Set-Out

- Notice where the gaps are.
- They give clarity to what’s happening in your program.
- Try to create your own convention and always lay your program out in the same way.
- Notice how your eyes are drawn to the tool change lines. These are usually the first things you are looking for.
Read On
It’s like reading a book without paragraphs, and page numbers. It also makes it easy to spot mistakes with well set out CNC code.

This is my dog, his name s “Get Back Here You Bastard”
See if you can find the simple error in the well set out code and let me know what it is. That way I will know you’re concentrating.
Clue: if you are the fortunate owner of a Haas machine it will spot this for you and alarm out.
Meaningful Comments
Insert meaningful comments. Remember you might not see this code for two years and you won’t remember what you did or how you were thinking at the time.
When you eventually come back to this code you’ll be scratching your arse for hours trying to figure it out.
You’ll think:
“Why the fuck did I do that”
A little comment will explain everything

Come on Get a Grip
Yes you will figure it out eventually but that’s the same with the human genome project.

Why do I need Well Set Out CNC Code (Things To Do)
- Leave gaps at strategic points in the program.
- Loads and loads of comments, write them as you would say it, (don’t try to be posh).
- Always make the order of the code the same.
- Write an SOP (Standard Operating Procedure) for how you want your code laid out.
- Make the tool change lines stand out these are the key points.
- Use N numbers at strategic points so that you can easily find things.
- Don’t use too many N numbers or you will get confused they are like E numbers they can drive you crazy. They also take up loads of memory.
- The machine setter and operator are your customers and you need to make their lives as easy as possible. Give em code that’s easy to read.
- If your writing X50. Y50. Z50. don’t write Z50. Y50. X50. Yes it will run OK trouble is it’s bloody confusing.
- Someone suggested adding M01 after each tool so I’m adding this in. (Thanks Michael)
An M1 or M01 is an optional stop which means you have the choice to stop at each tool. (Very useful if you want to stop at the next tool and you can’t stand around.)
Continuity
When you arrange the program in the same way every time it will be easy to spot mistakes. If you always put your spindle start and speed at the end of the first position line like this.
G90 G0 G54 X50. Y50. S1500 M03
Were you to miss out the speed you would have a very good chance of noticing it because the line will look wrong.
G90 G0 G54 X50. Y50. M03
Tidy neat code is the same as a neat tidy workshop. It’s much easier to find things.
Thanks for reading my post.
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
Classroom programmer 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.