G-Code Manual: Drufelcnc, 2020
G-Code Manual: Drufelcnc, 2020
G-Code Manual: Drufelcnc, 2020
DrufelCNC, 2020
Content
Annotation .................................................................................................................. 4
G53 - Disabling the offset of the origin of the coordinate system ............................. 25
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.
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.
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:
The speed value can be set once. You can also shorten your code. Short code will
look like this:
G00Z10
G00X0Y0
G01Z-5F50
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.
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.
Using I, J, and K, you specify the relative (incremental) distances from the starting
point of the arc to its center.
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.
Since the arc is greater than 180 ° (its center is located inside the chord), then R will
have a negative value
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.
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
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
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.
The preparatory function G10 is modal and remains active until it is canceled by code
G11, G53.
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
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
DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 18
G01Y-0.5F700
G02X14.1421Z14.1421R-20
G01X40.0Z-14.1421
G03X40.0Z14.1421R-20
G01x14.1421Z-14.1421
G00Y5
M5
G00X0Y0
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
DrufelCNC - software for controlling CNC machines. Read more: https://drufelcnc.com 19
G00X5
G01Y14.1421Z-14.1421
G01X-0.5F700
G02Y14.1421Z14.1421R-20
G01Y40.0Z-14.1421
G03Y40.0Z14.1421R-20
G01Y14.1421Z-14.1421
G00X5
M5
G00Y0Z0
The G31 or G31.x command allows you to move the axes to the specified position.
Using command G31 G31 or G31.x requires an encoder.
Movement by command G31 or G31.x is performed either until the specified position
is reached, or until the signal of the additionally installed encoder (skip signal) is
received.
The probing command will be executed until the probe hits or a certain distance is
covered.
In DrufelCNC, you can use G31, G31.0, G31.1, G31.2, G31.3, G31.4, G31.5, G31.6,
G31.7, G31.8, G31.9 (provided that these sensors are enabled and configured).
G31 - Probe
G31.1 - Probe 1
G31.2 - Probe 2
G31.3 - Probe 3
G31.4 - Probe 4
G31.5 - Probe 5
G31.6 - Probe 6
G31.7 - Probe 7
G31.8 - Probe 8
G31.9 - Probe 9
G38.2 - Probe towards the workpiece, contact stop, signal error in case of
malfunction
G38.3 - probe towards the workpiece, stop on contact
G38.4 - removal of the probe from the workpiece, stop on loss of contact, error in
case of failure
G38.5 - probe from the workpiece, stop on loss of contact
The G51 command allows you to use the scale 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
G00Z5
G00X0Y0
M3 S6000
G00Z0
G51X0Y0I3J4
G00X15Y15
G01X25Y15
G01X25Y25
G01X15Y25
G01X15Y15
M5
G00Z5
G00X0Y0
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.
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
G69 command is used to cancel the rotation of the coordinate system by a certain
angle.
G00Z5
G00X0Y0
M3 S6000
G00Z0
G68 R45.0
G00X15Y15
G01X25Y15
G01X25Y25
G01X15Y25
G01X15Y15
M5
G00Z5
G00X0Y0
Rotate the shape 45 degrees, add the line G68 R45.0. Total result:
Code G81 is for calling a standard drilling cycle. The following frame shows a typical
format for this loop:
X and Y determine the coordinates of the holes to be machined. Z indicates the final
drilling depth, and R is used to establish the retraction plane.
G00X0Y0
M3 S6000
G00Z5
G81X10Y10Z-6R1
G01X20Y10
G01X30Y10
G81X40Y10Z-7R2
G01X50Y10
G80
M5
G00X0Y0
Code G82 is for calling a pause drilling cycle. The following frame shows a typical
format for this loop:
X and Y determine the coordinates of the production holes. Z indicates the time of
the drilling depth, the address of the waiting time at the bottom of the hole. The
exposure time is indicated in milliseconds.
The G82 command is often used to drill blind holes, since the programmed waiting
time provides better chip removal from the bottom of the hole.
G00X0Y0
M3 S6000
G00Z5
G82X10Y10Z-6R1P700
G01X20Y10
G01X30Y10
G82X40Y10Z-7R2P1000
G01X50Y10
G80
M5
G00X0Y0
G98 - take back to the position in which the axis was located immediately before the
start of this series of one or more continuous continuous cycles.
G98 specifies a reset. G98 causes the tool to move to the position where it started
the cycle.
G99 specifies the return to the reference point or safe retraction zone. G99 causes
the tool to move to the point defined by the R parameter in the block with the hard
cycle function.