G68 is a G-code command that allows the user to rotate the coordinate system of a CNC machine by a specified angle around a specified point. This can be useful for machining parts that have angled features or holes, or for aligning the toolpath with the workpiece orientation .
Usage format
The general format of the G68 command is:
G68 X_ Y_ R_
where:
X_
andY_
are the coordinates of the center of rotation, relative to the current coordinate system.R_
is the angle of rotation, in degrees, measured counterclockwise from the positive X-axis.
For example, the command G68 X10 Y20 R45
would rotate the coordinate system by 45 degrees counterclockwise around the point (10, 20).
Explanation
The G68 command affects the coordinate system of the current program, but not the machine coordinate system. This means that the machine coordinates displayed on the control panel will not change, but the program coordinates will be transformed according to the rotation .
The G68 command is modal, meaning that it stays in effect until it is canceled by another command. To cancel the rotation, the user can use the G69 command, which restores the original coordinate system .
The G68 command can be used in conjunction with other G-code commands, such as G90 (absolute mode), G91 (incremental mode), G92 (offset mode), and G54-G59 (work coordinate systems). However, the user should be careful to apply the G68 command after setting the desired mode and coordinate system, and before specifying any motion commands .
Example
Suppose the user wants to machine a part that has a hole at an angle of 30 degrees from the horizontal, as shown in the following diagram:
/|
/ |
/ |
/ |
/____|____
| | /
| | /
| | /
| |/
|____|____
The user can use the G68 command to rotate the coordinate system by 30 degrees counterclockwise around the origin, and then drill the hole using the G81 command. The program would look something like this:
G90 G54 ; Set absolute mode and work coordinate system 1
G68 X0 Y0 R30 ; Rotate coordinate system by 30 degrees counterclockwise around origin
G00 X10 Y10 ; Rapid move to hole location
G81 Z-5 R2 F100 ; Drill hole with depth 5, retract 2, and feed 100
G80 ; Cancel drilling cycle
G69 ; Cancel coordinate system rotation
G00 X0 Y0 ; Rapid move to origin
M30 ; End of program
This is one way to use the G68 command to machine angled features. There are other ways to achieve the same result, such as using trigonometry to calculate the coordinates of the hole, or using a rotary table to rotate the workpiece. However, the G68 command can be a convenient and simple option for some cases .