G code and its function
G00------Quick positioning G01------Linear interpolation G02------Clockwise circular interpolation G03------Counterclockwise circular interpolation G04------Timed pause G05------Circular interpolation through the intermediate point G06------Parabolic interpolation G07------Z spline interpolation G08------Feed acceleration G09------Feed deceleration G10------Data setting G16------Polar coordinate programming G17------Processing XY plane G18------Processing XZ plane G19------Processing YZ plane G20------Inch size (Fanuc system) G21-----Metric size (Fanuc system) G22------Radius size programming method G220-----Used on the system operation interface G23------Diameter size programming method G230-----Use on the system operation interface G24------End of subroutine G25------Jump processing G26------Cycle processing G30------Cancel the override G31------Define the override G32------Equal pitch thread cutting, English G33------Equal pitch thread cutting, Metric G34------Increase pitch thread cutting G35------Decrease pitch thread cutting G40------Cancel tool compensation/tool offset G41------Tool compensation--left G42--- ---Tool compensation--right G43------Tool offset--positive G44------Tool offset--negative G45------Tool offset +/+G46------Tool offset +/-G47------Tool offset -/-G48------Tool offset -/+G49------Tool offset 0/+G50------Tool offset 0/-G51------Tool offset +/0G52------Tool offset -/0G53------Linear offset, cancel G54------Set Set workpiece coordinates G55------Set workpiece coordinate 2 G56------Set workpiece coordinate 3 G57------Set workpiece coordinate 4 G58------Set workpiece coordinate 5 G59------Set workpiece coordinate 6 G60------Accurate path mode (fine) G61------Accurate path mode (medium) G62------Accurate path mode (coarse) G63------Tapping G68------Tool offset, inner angle G69------Tool offset, outer angle G70------Inch size Inch (this is Siemens, Fanuc's is G21) G71------Metric size mm G74------Return to reference point (machine zero) G75------Return to programming coordinate zero G76------Threading compound cycle G80------Cancel fixed cycle G81------External circle fixed cycle G331-----Thread fixed cycle G90------Absolute size G91------Relative size G92------Prefabricated coordinates G93------Time countdown, feed rate G94------Feed rate, feed per minute G95------Feed rate, feed per revolution G96------Constant line speed control G97------Cancel constant line speed control
G code function detailed explanation
Fast positioning
Format: G00 X(U)__Z(W)__
Description: 1 This instruction enables the tool to quickly move to the specified position according to the point control method. The workpiece shall not be processed during the movement. 2 All programmed axes move at the speed defined by the parameters at the same time. When one axis reaches the programmed value, it stops, while other axes continue to move. 3 Coordinates that do not move do not need to be programmed. 4 G00 can be written as G0.
Example:
G00 X75 Z200G01 U-25 W-100 First, X and Z move 25 at the same time to quickly reach point A, and then Z moves 75 to quickly reach point B.
Linear interpolation
Format: G01 X(U)_Z(W)_F_(mm/min)
Description: 1 This instruction moves the tool to the specified position in a linear interpolation manner. The moving speed is the feed speed specified by F. All coordinates can be operated in linkage. 2 G01 can also be written as G1. Example: G01 X40 Z20 F150 two-axis linkage from point A to point B
Circular interpolation
Format 1: G02X(u)_Z(w)_I_K_F_
Description: 1X, Z in G90, the arc end point coordinates are absolute coordinate values relative to the programming zero point. In G91, the arc end point is the incremental value relative to the arc start point. Regardless of G90 or G91, I and K are the incremental coordinates of the arc center relative to the start point. Note: I is the X direction value and K is the Z direction value. The center coordinates must not be omitted during circular interpolation unless programmed in other formats.
2 When programming the G02 instruction, you can directly program a quadrant circle, a full circle, etc. Note: When passing the quadrant, clearance compensation will be automatically performed. If the clearance compensation input at the end of the parameter area is very different from the actual reverse clearance of the machine tool, obvious cuts will be produced on the workpiece. 3G02 can also be written as G2. Example: G02 X60 Z50 I40 K0 F120
Format 2: G02X(u)_Z(w)_R(+-)_F_
Description: 1 Cannot be used for full circle programming 2R is the radius of the single-sided R arc of the workpiece. R is signed, "+" means the arc angle is less than 180 degrees; "-" means the arc angle is greater than 180 degrees. The "+" can be omitted. 3 It is based on the coordinates of the end point. When the length between the end point and the starting point is greater than 2R, the arc is replaced by a straight line. Example: G02 X60 Z50 R20 F120
Format 3: G02X(u)_Z(w)_CR=_(radius)F_
Format 4: G02X(u)_Z(w)_D_(diameter)F_
These two programming formats are basically the same as format 2
Clockwise interpolation
Description: The format is the same as the G02 instruction except that the arc rotation direction is opposite.
Timed pause
Format: G04_F_ or G04_K_
Description: The machining motion is paused, and the machining continues after the time is up. The pause time is specified by the data after F. The unit is seconds. The range is 0.01 seconds to 300 seconds.
Intermediate point arc interpolation
Format: G05X(u)_Z(w)_IX_IZ_F_
Description: 1X, Z are the end point coordinate values, IX, IZ are the intermediate point coordinate values. The rest is similar to G02/G03. Example: G05 X60 Z50 IX50 IZ60 F120
Acceleration/deceleration
Format: G08
Description: They occupy a single line in the program segment. When the program runs to this segment, the feed rate will increase by 10%. If you want to increase it by 20%, you need to write it in two separate segments.
Radius programming
Format: G22
Description: If it occupies a line in the program, the system will run in radius mode, and the following values in the program will also be based on the radius.
Diameter size programming method
Format: G23
Description: If it occupies a line in the program, the system will run in diameter mode, and the following values in the program will also be based on the diameter.
Jump processing
Format: G25 LXXX
Description: When the program executes to this program, it will transfer the program segment it specifies. (XXX is the program segment number).
Cycle processing
Format: G26 LXXX QXX
Description: When the program executes to this program, the program segment it specifies starts to this segment as a loop body, and the number of loops is determined by the value after Q.
Multiplier cancellation
Format: G30
Description: If it occupies a line in the program, it will be used in conjunction with G31 to cancel the function of G31.
Ratio definition
G31 F_
G32: Equal pitch thread processing (English) G33: Equal pitch thread processing (Metric)
Format: G32/G33 X(u)_Z(w)_F_
Description: 1X, Z are the end point coordinate values, F is the pitch. 2G33/G32 can only process single-tool, single-start threads. 3The change of X value can process tapered threads. 4
When using this instruction, the spindle speed cannot be too high, otherwise the tool wear will be large. Set workpiece coordinates/set the highest (lowest) spindle speed
Format: G50 S_Q_
S is the highest spindle speed, Q is the lowest spindle speed
Set workpiece coordinates
Format: G54
There can be several coordinate systems in the system, G54 corresponds to the first coordinate system, and its origin position value is set in the machine tool parameters.
G55: Set workpiece coordinate 2 G56: Set workpiece coordinate 3 G57: Set workpiece coordinate 4 G58: Set workpiece coordinate 5 G59: Set workpiece coordinate 6
Accurate path mode
G60
In the actual processing process, when several actions are connected together, when using accurate path programming, there will be a buffer process (i.e. deceleration) when performing the next section of processing.
Continuous path mode
Format: G64
Compared to G60, it is mainly used for rough processing.
Return to reference point (machine zero point)
Format: G74 X Z
Description: 1 No other content shall appear in this section. 2 The coordinates that appear after G74 will return to zero in X and Z in sequence. 3 Before using G74, it must be confirmed that the machine tool is equipped with a reference point switch. 4 Single-axis zero return can also be performed.
Return to the programming coordinate zero point
Format: G75 X Z
Return to the starting point of the programming coordinate
Format: G76
Return to the position where the tool starts processing.
Outer circle (inner circle) fixed cycle
Format: G81_X(U)_Z(W)_R_I_K_F_
Description: 1X, Z are the coordinate values of the end point, U, W are the incremental values of the end point relative to the current point. 2R is the diameter of the starting section to be machined. 3I is the roughing feed, K is the finishing feed, I and K are signed numbers, and the signs of the two should be the same. The symbol convention is as follows: cutting from the outside to the center axis (turning the outer circle) is "-", and the opposite is "+". 4
Different X, Z, R determine different switches of the outer circle, such as: with or without taper, positive taper or reverse taper, left cutting or right cutting, etc. 5
F is the cutting speed (mm/min) 6
After the processing is completed, the tool stops at the end point. Example: G81 X40 Z 100 R15 I-3 K-1 F100
Processing process:
1) G01 feeds twice I (the first cut is I, the last cut is I+K finishing), and performs deep cutting: 2) G01 two-axis interpolation, cutting to the end section, if the processing is completed, stop: 3) G01 retracts I to a safe position, and performs auxiliary cutting surface smoothing at the same time 4) G00 quickly feeds to the outside of the high working surface I, and reserves I for the next cutting process, and repeats to 1.
Absolute value programming
Format: G90
Description: 1 When G90 is programmed, all the subsequent programmed coordinate values are based on the programming zero point. 2 After the system is powered on, the machine tool is in G state. N0010 G90 G92 x20 z90N0020 G01X40 Z80 F100N0030 G03X60 Z50 I0 K-10N0040 M02
Incremental programming
Format: G91
Description: 1 When G91 is programmed, all subsequent coordinate values are calculated using the previous coordinate position as the starting point. In the next coordinate system, the previous point is always used as the starting point for programming. Example: N0010 G91 G92 X20 Z85
N0020 G01X20 Z-10 F100N0030 Z-20N0040 X20 Z-15N0050 M02
Setting the workpiece coordinate system
Format: G92 X_ Z_
Description: 1 G92 only changes the coordinate value currently displayed by the system, and does not move the coordinate axis, so as to achieve the purpose of setting the coordinate origin. 2G92's effect is to change the displayed tool tip coordinates to the set value. 3G92's XZ can be programmed separately or all at once. G94-Feed rate, 4 feeds per minute
This is the default state of the machine tool when it is turned on.
Subprogram call
Format: G20 L_N_
Description: 1L is followed by the program name after the subprogram N to be called, but N cannot be entered. Only numbers 1 to 99999999 are allowed after N. 2This section of the program shall not contain any content other than the above description.
Subprogram end return
Format: G24
Description: 1G24 indicates the end of the subprogram and returns to the next section of the program that calls the subprogram. 2G24 appears in pairs with G20. 3G24 This section does not allow other instructions to appear.
G code programming example
Example: The following example illustrates the parameter transfer process during the subprogram call process. Please pay attention to the application.
Program name: P10M03 S1000G20 L200M02N200 G92 X50 Z100G01 X40 F100Z97G02 Z92 X50 I10 K0 F100G01 Z-25 F100G00 X60Z100G24
If you want to call it multiple times, please use the following format: M03 S1000N100 G20 L200N101 G20 L200N105 G20 L200M02N200 G92 X50 Z100G01 X40 F100Z97G02 Z92 X50 I10 K0 F100G01 Z-25 F100G00 X60Z100G24
G331--Thread processing cycle
Format: G331 X_ Z_I_K_R_p_
Description: 1X diameter change, X=0 is a straight thread. 2Z is the thread length, which can be programmed absolutely or relatively. 3I is the length of the thread back in the X direction after cutting, ± value 4
R is the diameter difference between the outer diameter and the root diameter of the thread, positive value 5
K is the pitch KMM6
p is the number of thread cycle processing, that is, how many cuts are required to complete the cutting. Tips:
1) The depth of each cut is R÷p and rounded, and the last cut does not feed to smooth the thread surface 2) The internal thread back is determined by the positive and negative directions along X to determine the value of I. 3) The starting position of the thread processing cycle is to align the tool tip with the outer circle of the thread.
Example: M3G4 f2G0 x30 z0G331 z-50 x0 i10 k2 r1.5 p5G0 z0M05
Supplement and precautions
G00 and G01
G00 motion trajectory has two types: straight line and broken line. This instruction is only used for point positioning and cannot be used for cutting processing; G01 moves to the target point specified by the instruction in a straight line at the specified feed rate, generally used for cutting processing.
G02 and G03
G02: Clockwise circular interpolation G03: Counterclockwise circular interpolation
G04 Delay or pause instruction
Generally used for forward and reverse switching, processing blind holes, stepped holes, and turning grooving
G17, G18, G19 Plane selection instructions
Specify plane processing, generally used for milling machines and machining centers. G17: X-Y plane, can be omitted, or can be a plane parallel to the X-Y plane. G18: X-Z plane or a plane parallel to it. There is only X-Z plane in CNC lathe, no need to specify it. G19: Y-Z plane or a plane parallel to it.
G27, G28, G29 Reference point command
G27: Return to reference point, check and confirm reference point position G28: Automatically return to reference point (through the middle point) G29: Return from reference point, used in conjunction with G28
G40, G41, G42 Radius compensation
G40: Cancel tool radius compensation G41: Left compensation G42: Right compensation
G43, G44, G49 Length compensation
G43: Positive length compensationG44: Negative length compensationG49: Cancel tool length compensation
G32, G92, G76
G32: Thread cuttingG92: Thread cutting fixed cycleG76: Thread cutting compound cycle
Turning: G70, G71, 72, G73
G71: Axial roughing compound cycle commandG70: Finishing compound cycleG72: Face turning, radial roughing cycleG73: Profiling roughing cycle
Milling machine, machining center:
G73: High-speed deep hole drillingG83: Deep hole drillingG81: Drilling cycleG82: Deep hole drilling cycleG74: Left-hand thread processingG84: Right-hand thread processingG76: Fine boring cycleG86: Boring cycleG85: ReamingG80: Cancel cycle command
Programming method G90, G91
G90: Absolute coordinate programming G91: Incremental coordinate programming
Spindle setting command
The 2018 National Swimming Championships held in Taiyuan, Shanxi ended the men's 400m freestyle competition. Zhejiang athlete Sun Yang won the championship with a time of 3 minutes 44.29 seconds, winning his third championship in this championship. This result ranks second in the world this year!
Spindle forward and reverse stop command M03, M04, M05
M03: Spindle forward M04: Spindle reverse M05: Spindle stop
Cutting fluid switch M07, M08, M09
M07: Mist cutting fluid on M08: Liquid cutting fluid on M09: Cutting fluid off
Motion stop M00, M01, M02, M30
M00: Program pause M01: Planned stop M02: Machine tool reset M30: Program ends, pointer returns to the beginning





