website templates
Coordinate system

CNC, what are we doing with that?


CNC-system are used to make some kind of machine to move between certan coordinates.
The thing you do (see the pic.):
For starters, you stand on point X0, Y0 in this coordinate-system. You want to move to the green (2,3)-position, you just tell the CNC to "(goto)(point) X2 (and) Y3"
And if you want to travel on to the red point (-3,1):
Tell the CNC to "(goto)(point) X-3 (and) Y1"

That's not  exactly how you do it, the things between (....) is only there to show how the machine actually do it, you need to add these in another format. 
You need to command the CNC to do thing with something that calls G and M codes.
If I add those to the above shown exemple it will be:
G01 X2 Y3.
G01 is a G code and tells the machine to move with a certan speed to the points shown.
G codes are used to control a massive amount of funktions, but some are more used and important than others.

tool rotating clockwise, M03

Tools and Tool movment
Tools are used to make cool stuff in the machine and on your work piece, for profit or for fun.
The tool can be an endmill (pic), turning inserts, water cutter, cutting torch even a 3D-printer and so on.
If you should use a endmilling tool you need to tell the CNC to start the tool, you need to tell the CNC witch direction (CW, CCW) and what amount of revolutions you need.
the important codes:
T01 = tool number in a mill
M6 = toolchange
S = revolutions, RPM
M03/04 = direction of rotation

Now we are going to choose a tool, and start the same:

T01 M6
S1000 M3

Tool path

Movments of Tool or Table 
When you cruise between ÿour coordinates, you need to control the movement, mostly you do this to not kill your expensive tools (avoid the crying manager?)
There are two kinds of linear movment to choose between.
G00 = is the fast travel, use this when travel witout cutting something, the speed of this is the machine max speed.
G01 = this is called linear interpolation, travel with decided speed.
The speed of G01 is set with "F300" if you want to travel just 300mm/min or ipm for the inch ppl (G90 or G91)


Program order
So? making the CNC-program then?

The thing a normal CNC mill/turn program needs to work is a combination of coordinates, G and M codes, tool-changes, tool-path-starts and so on. The rows that shows zeropoint, tool length are new, they be shown later, you find the down below the page

The program:
Choose the zeropoint for milling
Choose the tool you need
Choose the toolspeed
Start the tool
Choose the feed for tool or table-movment
Tell the CNC the length of the tool
Go to alot of coordinates
Stop the program

Go down for a closer view of the program exemple to the left

fanuc 21

Its time to make your first program, ready?


See the drawng of our work piece to the left or download it as a PDF
The whole workpice is 50x100

zero point

Define where our Zero point is located
You need to decide where to put your zero point for the cutting.
You can put the zero where ever you want, but it will be easiest to put it as the picture shows, then the drawing dimension will help us.
Alot of other things can make us to decide to put it anywhere else, but this is a good starter 


Choose and make path
you can go ether way when programing. Its wise to always lay your workpath so you get climb milling. Your surfaces and tools will thank you.

Codes again
Note, X, Y and Z according to the coordinate system abow
So for the program with tool dia 20mm, you need,:
-Set the zero
-Choose the tool and change tool
-set RPM, feed speed and rotation for the tool
- set the tool length
-go to the point named start, in X, Y and Z (G00)
-Go to the first point before the first turn (G01)
-Goto the second point before the second turn (G01)
-Go to the third point before the third turn (G01)
-Go to the END point (G01)
- Lift the tool abow the workpiece at a safe distance (G00)
-M30 (end the program)

For real:
-G54 (zero point setting)
-T01 M6 (tool 1 + change tool)
-S1000 F400 M3 (RPM=1000, Feed 4000 mm/min, CW rotation)
-G00 Z100 G43 H1 (move  z-axis to set length from value H1)
-G00 X10 Y-30 Z-10 (start pos, X on path, Y outside of WP, Z in cutting depth
-G01 Y50 (move with cutting feed to point one)
-G01 X90 (snd point)
-G01 Y10 (trd point)
-G01 X-30 (to the END point)
-G00 Z100 (safe point after cutting)
-M30 (end the program)

Finished program in FANUC 21 software

 This is how it should look in the programming software or the machine when you using FANUC 21.
Check the markings that are used in every row, the N-thing, thats useful for finding an error, the ; means End Of Line (EOB)

fanuc 21

Do it yourself
Start the CNC-simulator and try the code, you got the code for this programming already there, ready to go, link to the CNC simulator on this site
The CNC simulator can be programmed exactly as a real machine with almost all G codes
This simulator ignores tool changes, M codes and things like G43, you can have them in the program, but they will not execute
Use this simulator as a trainer tool where you can try your programming skills