There are dozens of G-codes for CNC systems, and in actual production, only a dozen or so core instructions are used in 80% of machining scenarios. According to their functions, they can be divided into four categories: coordinate system setting, motion control, tool compensation, and fixed cycle, covering the vast majority of basic machining needs.
1. Coordinate System and Setting Class: Establishing Processing Benchmarks
This type of instruction is used to define the workpiece coordinate system, set units and feed modes, and is the basic framework of the program.
Selection of Coordinate System for G54~G59 Workpieces
The most commonly used coordinate system instructions correspond to the preset workpiece coordinate systems numbered 1-6. Before processing, the workpiece origin is written into the corresponding coordinate system through tool setting, and the processing benchmark can be established by calling G54 in the program, which is the standard configuration for batch processing.
G90 absolute coordinate programming/G91 incremental coordinate programming
In G90 mode, all coordinate values are calculated relative to the workpiece origin; In G91 mode, the coordinate value is the incremental distance relative to the previous point. Conventional processing often uses G90 absolute coordinates for easy verification of dimensions.
G92 Set workpiece coordinate system
By setting the coordinate system based on the current tool position, it is mostly used for temporary tool alignment of single workpieces, and has gradually been replaced by fixed coordinate systems such as G54 in mass production.
2. Motion control category: defining the tool path
This type of instruction directly controls the movement of the tool and is the most essential part of the CNC program.
G00 quick positioning
The tool moves to the target position at the fastest speed set by the machine tool, does not participate in cutting, and is only used for fast idle travel. When using, be careful to avoid the fixture and workpiece, and avoid hitting the knife.
G01 Linear Interpolation
The tool moves in a straight line at a specified feed rate F and is used in most linear machining scenarios such as flat milling, step machining, and linear cutting. It must be used in conjunction with the feed rate F value.
Example: G01 X100. Y50. F200 represents walking straight at a feed rate of 200mm/min to the positions of X100 and Y50.
G02 clockwise arc interpolation/G03 counterclockwise arc interpolation
The tool moves along a circular arc trajectory, with G02 being a clockwise arc and G03 being a counterclockwise arc, used for machining circular arc contours, rounded corners, hole positions, etc. When programming, it is necessary to specify the endpoint coordinates and arc radius R, or the center coordinates I and J.
Example: G02 X50. Y0 R25. F150 represents walking a circular arc with a radius of 25mm clockwise to the target point.
G04 pause instruction
The tool pauses at the current position for a specified time, commonly used in scenarios such as countersunking, groove bottom finishing, and drilling stopping, to ensure a smooth machining surface. The format is G04 X1.0, which means pause for 1 second.
3. Tool compensation category: adapted to tool size and wear
This type of instruction is used to compensate for differences in tool radius and length, and can adapt to different tools and wear compensation without modifying the trajectory program.
G41 tool radius left compensation/G42 tool radius right compensation/G40 cancel radius compensation
When programming, program according to the contour dimensions of the workpiece, and the system automatically offsets the trajectory based on the tool radius, which is a necessary instruction for contour milling. G41 is offset to the left along the cutting direction, G42 is offset to the right, and G40 is used to cancel compensation.
G43 tool length positive compensation/G44 negative compensation/G49 cancel length compensation
Used to compensate for the length differences of different cutting tools, calling the corresponding tool length compensation value to ensure accurate Z-direction machining depth. After changing the tool, the length compensation corresponding to the tool number must be called again.
4. Fixed cycle class: Simplify repetitive processing actions
For repetitive processes such as drilling, tapping, and boring, a single G-code can be used to complete the complete action of "quick positioning → machining → quick retraction", greatly simplifying the program.
G81 drilling cycle: basic drilling cycle, suitable for ordinary shallow hole processing;
G83 deep hole drilling cycle: segmented feed, intermittent tool retreat and chip removal, suitable for deep hole machining;
G84 tapping cycle: spindle rotates forward to tap in and backward to exit, suitable for rigid tapping;
G80 cancels fixed loop: ends loop mode and resumes normal motion commands.
广东省东莞市长安镇涌头社区涌业东路4号2号楼102室
+86 137 3616 7873
sales@richengjm.com
版权所有©Copyright 2023东莞市日诚精密科技有限公司 技术支持:海川科技