0% found this document useful (0 votes)
39 views

DrufelCNC Gcode

Uploaded by

info
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

DrufelCNC Gcode

Uploaded by

info
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

G-code manual

DrufelCNC, 2020
Content

Annotation .................................................................................................................. 3

G00 - Accelerated movement...................................................................................... 4

G01 - Linear interpolation ........................................................................................... 4

G02, G03 - Circular interpolation................................................................................. 8

G04 - Pause ............................................................................................................... 14

G17, G18, G19 ........................................................................................................... 14

G10 - Enable data entry mode................................................................................... 18

G20 - Input inch data ................................................................................................. 20

G21 - Enter metric data ............................................................................................. 20

G53 - Disabling the offset of the origin of the coordinate system ............................. 21

G90 - Absolute positioning mode. ............................................................................. 21

G91 - Relative positioning mode. .............................................................................. 21

G68 - Rotate coordinate system ................................................................................ 22

G50, G51 - Zoom mode ............................................................................................. 24

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 2


Annotation

This document is a G code user guide. These G-codes can be used in the DrufelCNC
software. G-code is a programming language for numerically controlled machines
and machine tools.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 3


G00 - Accelerated movement.

Code G00 is used for faster movement. Accelerated movement is necessary for quick
movement.
The speed of the tool is too high and inconsistent!
The use of the G00 code reduces the overall processing time.

G01 - Linear interpolation

Code G01 is designed to perform tool movement in a straight line at a given speed.
The main difference between the G01 code and the G00 is that with linear
interpolation, the tool moves at a given speed. Movement speed is indicated by the F
command. Conventionally, a frame for linear interpolation is written as follows:

G01 Xn.n Yn.n Zn.n F n.n


G01 Xn.n Yn.n Zn.n An.n Bn.n Cn.n Fn.n

Consider the following simple program:

X0Y0 - zero position


G00X0Y0Z-5 - lowering the cutter along the z axis by -5mm
G01X30Y50F50 - moving the tool to a point (30; 50) with a working feed speed of 50
mm / min
G00X30Y50Z10 - raising the cutter along the z axis by 10mm

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 4


Let's complicate the program a bit. Let's write a program cutting a polygon.

G00Z10 ;raise the cutter to a safe position from the workpiece


G00X0Y0 ;zero position
G01X0Y0Z-5F50 ;lowering the cutter along the axis on z by -5 with a working feed
speed of 50 mm / min
G01X30Y50F50 ; moving the tool to a point (30; 50) with a working feed speed of 50
mm / min
G01X30Y100 ;moving the tool to a point (30; 100)
G01X0Y150 ;moving the tool to a point (0; 150)
G00X0Y150Z10 ;raising the cutter along the axis by z by 10
G00X0Y0 ;move to zero position

The speed value can be set once. You can also shorten your code. Short code will
look like this:

G00Z10
G00X0Y0
G01Z-5F50

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 5


G01X30Y50
G01Y100
G01X0Y150
G00Z10
G00X0Y0

Let's try to write a program for a more complex figure:

G00F300 ;for G00 commands we set the speed to 300


G01F300 ;for G01 commands we set the speed to 300
M03S24000 ;turn on the spindle at a speed of 24000 rpm
G00Z3 ;raise the cutter to a safe position
G00X25.325Y47.45 ;moving the tool to a point (25.325; 47.45)
Z-0.03 ;axis milling cutter axis z -0.03
X31.275Y29.275 ;move tool to point
X50.675Y29.325 ;moving the tool to a point
X34.95Y18.125 ;move the tool to a point
X41Y0 ;move tool to point
X25.325Y11.25 ;move tool to point
X9.625Y0 ;move tool to point
X15.675Y18.125 ;move tool to point
X-0.05Y29.325 ;move the tool to a point
X19.35Y29.275 ;moving the tool to a point
X25.325Y47.45 ;move the tool to a point
G00Z3 ;raising the cutter along the axis by z by 3
M05 ;spindle shutdown
G00X0Y0 ;move to zero position

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 6


DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 7
G02, G03 - Circular interpolation

Codes G02 and G03 are designed to perform circular interpolation. G02 command is
used to move in an arc clockwise, and G03 - counterclockwise.

The direction of movement is determined when we look at the tool from the spindle
side, in the negative direction of the Z axis. As with linear interpolation, in the
circular interpolation block, you must specify the feedrate F.

There are two ways to form a circular interpolation frame:


 setting the center of the circle using I, J, K;
 setting the radius of the circle with R.

Arc with I, J, K
For a complete description of the arc, it is not enough to specify only the coordinates
of its end point. You must also specify the coordinates of the center.

I, J, K are used to determine the center of the arc

Using I, J, and K, you specify the relative (incremental) distances from the starting
point of the arc to its center.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 8


You must specify a positive value for I and a negative value for J

You must specify a positive value for I and a positive value for J

Arc with R

A simpler way to specify the center of the arc is based on applying the address R
(radius). To unambiguously determine the shape of the arc, you must specify the
corresponding sign in front of the numerical value of the radius R. For an arc that is
greater than 180 °, the value of R will be negative. For an arc that is less than 180 °,
the R value will be positive.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 9


Since the arc is less than 180 ° (its center is located outside the chord), then R will
have a positive value

Since the arc is greater than 180 ° (its center is located inside the chord), then R will
have a negative value

Using G02 and G03


Let's see how circular interpolation works, using an example. The following fragment
of the control program moves the tool along an arc with a radius of 8 mm from point
A (0; 0) to point B (8; 8) with a working feed speed of 80 mm / min.

G01X0Y0
G02 X8.0 Y8.0 I8.0 J0.0 F80

Since the center of the arc is at a distance of 8 mm along the X axis and 0 mm along
the Y axis relative to the starting point A, then I will be 8.0, and J is 0. The resulting
arc is only a quarter of the full circle. Let's try to describe the whole circle gradually.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 10


Moving along an arc with R = 8 from point A (0; 0) to point B (8; 8)

The next frame moves the tool from point B (B1) to point B2. Since the feedrate does
not change, there is no need to re-specify the data F-word.
Since the center of the arc is at a distance of 0 mm along the X axis and 8 mm along
the Y axis relative to point B, then I will be 0, and J will be -8. Thus, we were able to
create a displacement along an arc from point A to point B2 using two frames.
Currently, most CNC systems allow you to perform an operation to describe the full
circle in two or even one frame. Therefore, the movement from point A to point C
can be written as follows:

G01X0Y0
G02 X8.0 Y8.0 I8.0 J0.0 F80
G02 X16.0 Y0.0 I-8.0 J0.0

Modern CNC systems allow the description of such an arc in one block
G01X-8Y0
G02 X-8.0 Y0.0 I8.0 J0.0

Full circle description in one frame is also possible.


DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 11
Spiral.

If the XY plane (G17) is activated and the Z word is programmed in the circular
interpolation block, then a spiral forms in the XY plane. The direction of the arc or
spiral in the XY plane can be determined visually.

An example of a spiral:

G01F800
G01X0Y0Z0
G02X0Y0Z-10I38J38
G02Z-20I38J38
G02Z-30I38J38
G02Z-40I38J38
G02Z-50I38J38
G02Z-60I38J38
G02Z-70I38J38
G02Z-80I38J38
G01X10Y10

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 12


An example of a finished program:

G00X0Y0 ;zero position


M3 S6000 ;turn on the spindle at a speed of 6000 rpm
G00Z5 ;raise the cutter to a safe position
G01X14.1421Y-14.1421 ;moving a tool to a point
G01Z-0.5F700 ;moving a tool to a point at a speed of 700
G02X14.1421Y14.1421R-20 ;using the G02 command using R
G01X40.0Y-14.1421 ;moving a tool to a point
G03X40.0Y14.1421R-20 ;using the G02 command using R
G01x14.1421y-14.1421 ;move the tool to a point
G00Z5 ;raising the cutter along the axis by z by 3
M5 ;spindle shutdown
G00X0Y0 ;move to zero position

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 13


G04 - Pause

Command G04 is used to delay control program execution or pause. This modeless
code is used in conjunction with the S- or P-address, which indicates the length of
the exposure time. Usually this time is from 0.001 to 99999.999 seconds.

Code G04, S- or P-address are programmed together in a single block that does not
contain any movements.

If P is used to determine the holding time, then the decimal point cannot be
programmed. Address P determines the holding time in milliseconds, and S in
seconds.

Example:
G04 S1.5 ;shutter speed 1.5 seconds;
G04 P200 ;shutter speed 200 milliseconds.

G17, G18, G19

In CNC programming, there are 3 G-codes for selecting a plane during NC


programming, which are used to define two axes: X, Y or Z. The plane selection is
modal and is valid for everyone until you enter a different circular plane command.

The 3 Plane selection G-Codes are:


G17 for XY Plane
G18 for XZ Plane
G19 for YZ Plane

XY plane selection with G17 code.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 14


The XY G17 plane selection code is set by default and sets the plane to the circular
interpolation mode G02 and G03.

In the circular interpolation blocks, the words X, Y, Z, I and J. are valid. The word K is
not valid. If the Z word is programmed in a circular interpolation block, then a spiral
forms in the XY plane. The direction of the arc or spiral in the XY plane can be
determined visually: Positive direction X - to the right side, positive direction Y - up.
The XY plane has a right-handed coordinate system. In G17, the endpoint of the arc is
defined in the block by the words X and Y. The center point of the arc is defined in
the block by the words I and J.
G17 is activated by default. Code G17 is canceled by codes G18 and G19.

Example:
G17
G00X0Y0
M3 S6000
G00Z5
G01X14.1421Y-14.1421
G01Z-0.5F700
G02X14.1421Y14.1421R-20
G01X40.0Y-14.1421
G03X40.0Y14.1421R-20
G01X14.1421Y-14.1421
G00Z5
M5
G00X0Y0

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 15


XZ plane selection. Code G18

XZ plane selection code G18 sets the plane to circular interpolation mode G02 and
G03. In the circular interpolation blocks, the words X, Y, Z, I and J. are valid. The word
J is not valid. If the word Y is programmed in a circular interpolation block, a spiral
forms in the XZ plane. The direction of the arc or spiral in the XZ plane can be
determined visually: The positive X direction is to the right, the positive Z direction is
up. The XZ plane has a right-handed coordinate system.
Code G18 is canceled by codes G17 and G19.

Example:
G18
G00X0Z0
M3 S6000
G00z5
G01X14.1421Z-14.1421
G01Y-0.5F700
G02X14.1421Z14.1421R-20
G01X40.0Z-14.1421
G03X40.0Z14.1421R-20
G01x14.1421Z-14.1421
G00Y5
M5

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 16


G00X0Y0

YZ plane selection. Code G19

The YZ plane selection code G19 sets the plane to circular interpolation mode G02
and G03. In circular interpolation blocks, the words X, Y, Z, I, and K are valid. Word I
is not valid. If the word X is programmed in a circular interpolation block, then a
spiral forms in the YZ plane. The direction of the arc or spiral in the YZ plane can be
determined visually: The positive direction Y is to the right, the positive direction Z is
up. The YZ plane has a right-handed coordinate system. In G19, the end point of the
arc is defined in the block by the words Y and Z. The center point of the arc is defined
in the block by the words J and K. Code G19 is canceled by codes G17 and G18.

Example:
G19
G00Y0Z0
M3 S6000
G00X5
G01Y14.1421Z-14.1421
G01X-0.5F700
G02Y14.1421Z14.1421R-20
G01Y40.0Z-14.1421
G03Y40.0Z14.1421R-20

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 17


G01Y14.1421Z-14.1421
G00X5
M5
G00Y0Z0

G10 - Enable data entry mode.

Set new coordinates for the origin

Format: G10 X10 Y10 Z10 A B C

The preparatory function G10 is modal and remains active until it is canceled by code
G11, G53.

Let's look at an example:


G00X0Y0
M3 S6000
G00Z5
G00X45Y45
G01X65Y45
G01X65Y65
G01X45Y65
G01X45Y45
M5
G00X0Y0

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 18


DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 19
Add a line: G10 X10 Y30

G20 G21

G20 - Input inch data


Code G20 activates the mode of working with inch data. While this mode is in effect,
all input data is perceived as inch. It is recommended that in all programs that are
written in inch sizes, put the G20 command at the beginning of the program, so that
if the program that was running before, the metric mode was in effect, ensure that
the correct format is selected.
The command is modal and is valid until canceled by the G21 command.

G21 - Enter metric data


Code G21 activates the metric data mode. While this mode is in effect, all input data
is perceived as metric. It is recommended that in all programs that are written in
metric sizes, put the G21 command at the beginning of the program, so that if the
inch program was in effect before, ensure that the correct format is selected.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 20


G53 - Disabling the offset of the origin of the coordinate system

The G53 command is used to disable the offset of the origin of the coordinate
system.
When the G53 command is executed, the working coordinate offsets are temporarily
canceled and the machine coordinate system is used.
The G53 command is a safe way to return to the initial position of the machine.
The offset values of the origin of the coordinate system are stored in tables.
The G53 command is not modal, acting only in the frame in which it is assigned.

G90 - Absolute positioning mode.


In the absolute positioning mode G90, the actuators are moved relative to the zero
point of the working coordinate system G54-G59 (it is programmed where the tool
should move). The G90 code is canceled using the relative positioning code G91.

G91 - Relative positioning mode.


In the relative (incremental) positioning mode G91, the position of the actuator,
which it occupied before moving to the next reference point, is each time taken as
the zero position (it is programmed how long the tool should move). Code G91 is
canceled by absolute position code G90.

G90.1 Absolute distance mode for I, J and K offsets.


G91.1 Incremental distance mode for I, J and K offsets.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 21


G68 - Rotate coordinate system

The G68 command is used to perform rotation (rotation) of the coordinate system by
a certain angle.
Command format: G68 X__ Y__ Z__ R

The choice of coordinates depends on the selected plane (G17, G18, G19). X and Y
and Z are the coordinates of the point relative to which the coordinate system will be
rotated, and R - determines the value of the angle of rotation. If X Y is not specified,
then X Y Z are equal to the previous position.

G69 command is used to cancel the rotation of the coordinate system by a certain
angle.

Example using the G68 and G69 commands:


First, create a simple square program.

G00Z5
G00X0Y0
M3 S6000
G00Z0
G68 R45.0
G00X15Y15
G01X25Y15
G01X25Y25
G01X15Y25
G01X15Y15
M5
G00Z5
G00X0Y0

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 22


Rotate the shape 45 degrees, add the line G68 R45.0. Total result:

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 23


G50, G51 - Zoom mode

The G51 command allows you to use the zoom mode in numerical control systems.
For each axis, it is possible to specify a scaling factor.
Command format: G51 X Y Z I J K
I - scale for X
J - scale for Y
K - scale for Z
X Y Z - coordinates of the center of scaling

Command format: G51 X Y Z A B C P


P - scale for axes X Y Z A B C
X Y Z A B C - coordinates of the center of scaling

The G50 command allows you to cancel the scaling mode with numerical control
systems (CNC) of machines.

Consider an example of using the G50 and G51 commands below:


First, create a simple square program.

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 24


Scale the shape by adding the line G51X0Y0I2I2. Total result:

G00Z5
G00X0Y0
M3 S6000
G00Z0
G51X0Y0I3J4
G00X15Y15
G01X25Y15
G01X25Y25
G01X15Y25
G01X15Y15
M5
G00Z5
G00X0Y0

DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 25

You might also like