Here you can learn what G-Codes are and how to work with.

G codes are the commands of the cnc machines.
In our live we know also commands like : take that  and let it go.
A machine is the same , he knows nothing accept you tell hem something to do and then he do it very fast and good.

When you make a program ( a list with commands ) and at the beginning of that program you have say “spindle on” then the spindle goes on until you say “spindle stop”.
That is with all the commands.

There are different type of commands.
M functions are machine function like spindle on , program stop
G functions are machine movements functions

The M and G functions can be different on diferent machines.

G0 , G1 G2 G3 M3 M30 are always the same.

I explain G-Codes from Dialog 11 from Deckel.
The principles are de same , but some numbers are different.
Also some machine don’t like M0, M5 , but M00 , M05 and thats also with G01 G02 etc.

N10 , N20 etc. are line numbers

So let start.

M Codes

First i shall explain some M codes.
M0 = program stop until you press the start button to continuation the program.
M3 = Spindle on clock wise
M4 = Spindle on counter clock wise
M5 = Spindle Stop
M6 = Tool change
M8 = cooling on
M9 = cooling off
DSCF0092

G-Codes

G1 - Straight Line

With G1 you can make a straight line from A to B.

DSCF0094

The program likes this :
N1 G17
N2 T1 M6
N3 S4000 F1000 M3

N10 G0 X25 Y15 Z2
N20 G1 Z-5
N30 G1 X80 Y65
N40 G0 Z10
N50 M30

What’s Happened.
- The Cutter is in Z direction
- Take Tool nr 1
- S = turningspeed turns/minute F=Toolspeed mm/min spindle on
- In high speed Goto X25 Y15 and Z2
- Goto in Toolspeed to the depth of 5 mm
- Goto in Toolspeed to X80 and Y65
- Goto in High speed to Z10
- End of program

G2 - Cirkel clockwise / G3 - Counter clockwise

With G1 you can make a straight line from A to B.

DSCF0101
DSCF0100

The program likes this :
N1 G17
N2 T1 M6
N3 S4000 F1000 M3
N10 G0 X50 Y67.5 Z2
N20 G1 Z-5
N30 G2 X22.5 Y40 I50 J40

N40 G0 Z10
N50 M30

What’s Happened.
- The Cutter is in Z direction
- Take Tool nr 1
- S = turningspeed turns/minute F=Toolspeed mm/min spindle on
- In high speed Goto X50 Y67.5 and Z2
- Goto in Toolspeed to the depth of 5 mm
- Make a clockwise circle in Toolspeed to X22.5 and Y40 with a circle center X50 and Y 40
- Goto in High speed to Z10
- End of program

So this was the beginning, now we go to the second stage.

When you want to make an inside rectangle. That is not so difficult, but when you must make 4000 of them, you can not make them with 1 tool. When we have a lot of new tools , it’s also not a problem, but when you don’t have all new tools you have a problem because all the diameters of the tools are different. To solve that problem we use G41 and G42 in our program.  G41 and G42 are toolradius compensation commands. G41 is left of the contour and G42 is at the right of the contour. G40 stops compensation.

DSCF0104
DSCF0105

G41 / G42 - Tool Compensation

DSCF0106
DSCF0107

The program likes this :
N1 G17
N2 T1 M6
N3 S4000 F1000 M3
N10 G0 X-5 Y-20 Z2
N20 G1 Z-7
N30 G41 G1 X16 Y16
N40 Y35
N50 X53 Y65
N60 X90 Y35
N70 Y16
N80 X16
N90 G40
N100 G0 Z10
N110 M30

What’s Happened.
- The Cutter is in Z direction
- Take Tool nr 1
- S = turningspeed turns/minute F=Toolspeed mm/min spindle on
- In high speed Goto X-5 Y-20 and Z2
- Goto in Toolspeed to the depth of 7 mm
- Go with toolspeed to X16 and Y16 with toolradius compensation
- follow the coordinates

- Stop toolradius compensation
- Goto in High speed to Z10
- End of program