G18 G-Code Command
G18 is a G-code command used in CNC machining that specifies the plane of movement for circular interpolation in the X-Z plane, which is perpendicular to the Y-axis. This command is often used in conjunction with G02 and G03 commands, which respectively specify clockwise and counterclockwise circular interpolation movements. By using G18 along with these commands, CNC machines can create circular shapes and contours in the X-Z plane with precision and accuracy.
How G18 G-Code Command is used
Here’s an example of G18 being used in a G-code program with comments:
G90 // Absolute positioning
G54 // Work coordinate system 1
G00 X0 Y0 Z0 // Rapid move to starting position
M03 S1000 // Spindle on, clockwise rotation at 1000 RPM
G01 Z-0.5 F100 // Move down to cutting depth at a feed rate of 100 mm/min
G18 // Select X-Z plane for circular interpolation
G02 X50 Z-25 R25 // Move in a clockwise circular arc with a radius of 25 mm
G01 X70 F200 // Move linearly to the right at a feed rate of 200 mm/min
G03 X90 Z-45 R25 // Move in a counterclockwise circular arc with a radius of 25 mm
G01 X110 F200 // Move linearly to the right at a feed rate of 200 mm/min
G00 Z10 // Rapid move up to retract the tool
M05 // Spindle off
In this example, the G18 command is used after the tool has reached the cutting depth to specify that the subsequent circular interpolation movements will be in the X-Z plane. The G02 and G03 commands are then used to create clockwise and counterclockwise circular arcs in the X-Z plane, respectively.