1. Brief description of G code functions
G00——Quick positioning
G01——Linear interpolation
G02——Clockwise arc interpolation
G03——Arc interpolation counterclockwise
G04——Timed pause
G05——Circular interpolation by intermediate point
G06——Parabolic interpolation
G07——Z spline interpolation
G08——feed acceleration
G09——feed deceleration
G10——Data parameters
G16——Polar coordinate programming
G17——Processing the XY plane
G18——Processing of the XZ plane
G19——Processing of the YZ plane
G20——Size in inches
G21 —– Metric size
G22——radius dimension programming method
G220 —– Used on system operation interface
G23——Diameter size programming method
G230 —– Used on system operation interface
G24——End of subroutine
G25——Jump processing
G26——Cycle processing
G30——rate cancellation
G31——magnification definition
G32——Constant pitch thread, inch system
G33——Constant pitch thread, metric
G34——increased pitch thread
G35——reduced pitch thread
G40——Tool compensation/tool offset cancellation
G41——Tool compensation-left
G42——Tool compensation-right
G43——Positive tool offset
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 +/0
G52——Tool offset-/0
G53——Linear offset, disconnection
G54——Set part coordinates
G55——Set room coordinate two
G56——Set the coordinate of part three
G57——Set coordinate of part four
G58——Set part coordinate five
G59——Set coordinate of part six
G60——Precise path mode (fine)
G61——Precise trajectory mode (middle)
G62——Precise trajectory mode (coarse)
G63——Threading
G68——Tool offset, inside corner
G69——Tool offset, outside corner
G70——Size in inches, inches
G71——Metric dimensions, mm
G74——return to reference point (machine zero point)
G75——return to zero point of programming coordinates
G76——Thread Compound Cycle
G80——disconnect from fixed cycle
G81——outer circle fixed cycle
G331 —– Thread canned cycle
G90——absolute size
G91——Relative dimensions
G92——Prefabricated coordinates
G93——countdown, feed rate
G94——feed rate, feed per minute
G95——advance, advance per revolution
G96——constant linear speed control
G97——Cancel constant linear speed control
2. Detailed explanation of G code functions
1. Quick positioning
Format: G00 X(U)__Z(W)__
1) This command allows the tool to move quickly to the specified position according to the point control mode. The workpiece should not be processed during movement.
2) All programmed axes move simultaneously at the speed defined by the parameters. When an axis reaches the programmed value, it stops, while the other axes continue to move.
3) No programming is required for stationary coordinates.
4) G00 can be written G0
2. Linear interpolation
Format: G01 X(U)__Z(W)__F__(mm/min)
1) This command moves the tool to the specified position using linear interpolation. The movement speed is the feed rate of the F command. All coordinates can be executed jointly.
2) G01 can also be written G1
3. Interpolation of arcs
Format 1: G02X(u)____Z(w)____I____K____F______
1) When X and Z are at G90, the arc end point coordinates are the absolute values of the coordinates relative to the programmed 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 center of the arc relative to the starting point. I is the X direction value and K is the Z direction value. The circle center coordinates cannot be omitted during arc interpolation unless programmed in other formats.
2) When programming the G02 instruction, you can directly program quadrant circles, full circles, etc.
Note: When crossing the quadrant, compensation for the gap will be automatically carried out. If the offset compensation input at the end of the parameter area is significantly different from the actual reverse offset of the machine tool, obvious cuts will be produced on the part.
3) G02 can also be written G2.
Example: G02 X60 Z50 I40 K0 F120
Format 2: G02X(u)____Z(w)____R(+\-)__F__
1) Cannot be used for full loop programming
2) R is the radius of the arc R on one side of the part. 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 value between the end point and the start point is greater than 2R, a straight line is used instead of the arc.
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
Note: Except for the opposite direction of arc rotation, the format is the same as the G02 command.
4. Scheduled break
Format: G04__F__ or G04__K__
The processing movement is interrupted once the time has elapsed, the processing continues. The pause time is specified by the data following F. The unit is seconds.
The range is from 0.01 seconds to 300 seconds.
5. Midpoint arc interpolation
Format: G05X(u)____Z(w)____IX_____IZ______F_____
X and Z are the coordinate values of the end point, and IX and IZ are the coordinate values of the intermediate point. Others are similar to G02/G03.
Example: G05 X60 Z50 IX50 IZ60 F120
6. Acceleration/deceleration
Format: G08
They occupy a single line in the program section. When this section is executed in the program, the feed rate will increase by 10%. If it is to be increased by 20%, it must be written in two separate sections.
7. Programming the radius
Format: G22
If it occupies its own line in the program, the system operates in radius mode and subsequent values in the program are also based on the radius.
8. Diameter size programming method
Size: G23
If it occupies its own line in the program, the system operates in diameter mode and subsequent values in the program are also based on diameter.
9. Jump processing
Format: G25 LXXX
When the program runs on this program, it transfers to the program segment it specifies. (XXX is the program segment number).
10. Cyclic treatment
Format: G26 LXXX QXX
When the program executes this section of the program, the specified program section starts with this section as the loop body, and the number of loops is determined by the value after Q.
11. Cancellation of the rate
Format: G30
Occupy its own line in the program and use it with G31 to override G31’s function.
12. Definition of magnification
Format: G31 F_____
G32—Constant Pitch (Imperial) Thread Processing
G33—Constant pitch (metric) thread processing
Format: G32/G33 X(u)____Z(w)____F____
1) X and Z are the coordinates of the end point and F is the step.
2) G33/G32 can only process single tool and single start threads.
3) Changes to the X value can handle tapered threads
4) When using this command, the spindle speed cannot be too high, otherwise the tool wear will be greater.
13. Set workpiece coordinates/set maximum spindle speed (low)
Format: G50 S____Q____
S is the highest spindle speed and Q is the lowest spindle speed.
14. Set room coordinates
Format: G54
There can be multiple coordinate systems in the system. G54 is the first coordinate system, and its original position value is set in the machine tool settings.
G55: set the coordinate of part two
Same as above
G56—Set Part Coordinate Three
Same as above
G57—Set Part Coordinate Four
Same as above
G58—Set Part Coordinate Five
Same as above
G59—Set part coordinate six
Same as above
15. Exact path method
Format: G60
In the actual processing process, when multiple actions are connected together and programmed with precise paths, there will be a buffering process (i.e. deceleration) when executing the next section of treatment.
16. Continuous path method
Format: G64
Compared to the G60. Mainly used for rough machining.
17. Return to reference point (machine zero point)
Format: G74 XZ
1) No other content may appear in this paragraph.
2) Coordinates appearing after G74 will return to zero in X and Z order.
3) Before using the G74, you must confirm that the machine tool is equipped with a reference point switch.
4) Single axis zero feedback can also be performed.
18. Return to zero point of programmed coordinates
Size: G75 XZ
Return to zero point of programmed coordinates
19. Return to starting point of programming coordinates
Format: G76
Return to the position where the tool started machining.
20. Canned cycle of the outer circle (inner circle)
Format: G81__X(U)__Z(W)__R__I__K__F__
1) X, Z are the end point coordinate values, U, W are the end point increment values from the current point.
2) R is the diameter of the starting section to be treated.
3) I is the rough turning feed, K is the finishing turning feed, I and K are signed numbers and the signs of both must be the same. The symbol convention is: cutting from the outside to the center axis (turning the outer circle) is “-“, and vice versa is “+”.
4) Different X, Z, R determine different switches of the outer circle, such as: with or without taper, forward taper or reverse taper, left cut or right cut, etc.
5) F is the cutting speed (mm/min).
6) Once processing is completed, the tool stops at the end point.
Example: G81 X40 Z 100 R15 I-3 K-1 F100
Treatment process:
1) G01 advances I 2 times (the first cut is I and the last cut is an I+K finish) for a deep cut.
2) G01 two-axis interpolation, cut to the final section and stop if processing is completed.
3) G01 retracts the knife I to a safe position and at the same time performs auxiliary smoothing of the cutting surface.
4) G00 quickly advances outward from the high work surface I, leaving I for the next cutting process, repeat up to 1.
21. Absolute value programming
Format: G90
1) When G90 is programmed, all coordinate values programmed in the future are based on the programmed zero point.
2) After the system is powered on, the machine tool is in G state.
N0010 G90 G92 x20 z90
N0020 G01X40 Z80 F100
N0030 G03X60 Z50 I0K-10
N0040M02
22. Incremental programming
Format: G91
When G91 is programmed, all subsequent coordinate values use the previous coordinate position as the starting point to calculate the programmed movement value. In the next segment of the coordinate system, the previous point is always used as the starting point for programming.
Example: N0010 G91 G92 X20 Z85
N0020 G01X20 Z-10 F100
N0030Z-20
N0040X20Z-15
N0050M02
23. Set the room coordinate system
Format: G92 X__ Z__
1) G92 only changes the coordinate value currently displayed by the system, without moving the coordinate axis, to achieve the purpose of setting the coordinate origin.
2) The effect of G92 is to change the displayed coordinates of the tool tip to the set value.
3) XZ behind G92 can be programmed separately or entirely.
24. Subroutine call
Format: G20 L__
N__
1) After L is the program name after N of the subroutine to be called, but N cannot be entered. Only numbers 1 to 99999999 are allowed after N.
2) This program must not contain content other than the description above.
25. End and return of the subroutine
Format: G24
1) G24 indicates the end of the subroutine and returns to the next section of the program that called the subroutine.
2) G24 and G20 appear in pairs
3) No other instructions are permitted in this section of G24.
3. G Code Programming Examples
Example: The following example illustrates the process of passing parameters when calling a subroutine.
Program name: P10
M03 S1000
G20L200
M02
N200 G92 X50 Z100
G01 X40 F100
Z97
G02 Z92 X50 I10 K0 F100
G01 Z-25 F100
G00 X60
Z100
G24
If you want to call it multiple times, please use it in the following format
M03 S1000
N100 G20 L200
N101 G20 L200
N105 G20 L200
M02
N200 G92 X50 Z100
G01 X40 F100
Z97
G02 Z92 X50 I10 K0 F100
G01 Z-25 F100
G00 X60
Z100
G24
G331—Thread machining cycle
Format: G331 X__ Z__I__K__R__p__
1) Diameter changes in X direction, X=0 is straight thread
2) Z is the thread length, absolute or relative programming is available
3) I is the runout length in the X direction after thread cutting, value ±
4) The diameter difference between the outer diameter of the thread R and the root diameter, positive value
5) Not K KMM
6) The number of thread processing cycles p, i.e. how many cuts are required to complete the cut
hint:
1) The depth of each cut is R÷p and rounded to the nearest integer. The final cut is not made to smooth the surface of the thread.
2) The name of internal thread removal is determined according to the positive and negative directions of X.
3) The starting position of the thread processing cycle is to align the tool tip with the outer circle of the thread.
example:
M3
G4 f2
G0x30z0
G331 z-50 x0 i10 k2 r1.5 p5
G0 z0
M05
4. Supplements and notes
1. G00 and G01
There are two types of G00 motion paths: straight line and polyline. This command 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 linear motion at the specified feed rate and is generally used for cutting processing.
2. G02 and G03
G02: Arc interpolation clockwise.
G03: Arc interpolation counterclockwise.
3. Delay or pause command G04
Generally used for forward and reverse switching, processing of blind holes, stepped holes, as well as turning and grooving.
4. Instructions for selecting plans G17, G18, G19
Specified surface treatment, typically used on milling machines and machining centers
G17: XY plane, can be omitted, or it can be a plane parallel to the XY plane
G18: XZ plane or plane parallel to it. There is only XZ plane in CNC lathes and does not need to be specially specified.
G19: YZ plane or a plane parallel to it
5. Reference point commands G27, G28, G29
G27: Return to reference point, check and confirm reference point position
G28: Automatic return to the reference point (intermediate point crossing)
G29: Reference point feedback, used in conjunction with G28
6. Radius compensation G40, G41, G42
G40: Cancel tool radius compensation
G41: Left tool radius compensation
G42: Straight tool radius compensation
7. Length compensation G43, G44, G49
G43: Positive length compensation
G44: Negative length compensation
G49: Cancel tool length compensation
8.G32, G92, G76
G32: Thread
G92: Fixed threading cycle
G76: Compound threading cycle
9. Turning processing: G70, G71, 72, G73
G71: Control of the axial roughing compound cycle
G70: Compound finishing cycle
G72: Face turning, radial rough turning cycle
G73: Copy of the rough turning cycle
10. Milling machines and machining centers:
G73: High speed deep stripping drilling
G83: Deep drilling
G81: drilling cycle
G82: Deep drilling cycle
G74: Left-hand thread processing
G84: Right-hand thread processing
G76: Fine boring cycle
G86: Boring machining cycle
G85: Bore
G80: Cancel cycle command
11. Programming method G90, G91
G90: Absolute coordinate programming
G91: Incremental coordinate programming
12. Spindle adjustment control
G50: Setting the maximum spindle speed
G96: Constant linear speed control
G97: Spindle speed control (cancel constant linear speed control command)
G99: Return to point R (middle hole)
G98: Return to reference point (last hole)
13. Spindle forward and reverse stop commands M03, M04, M05
M03: Spindle front transmission
M04: Spindle reverse rotation M05: Spindle stop
14. Coolant switches M07, M08, M09
M07: Spray cutting fluid on
M08: Opening the liquid cutting fluid
M09: Cutting fluid
15. Stopping movement M00, M01, M02, M30
M00: program pause
M01: Final plan
M02: Resetting the machine tool
M30: The program ends and the pointer returns to the beginning
16. M98: subroutine call
17. M99: Return to the main program
Daguang focuses on providing solutions such as precision CNC machining services (3-axis, 4-axis, 5-axis machining), CNC milling, 3D printing and rapid prototyping services.



