Gcode and commands

来源:互联网 发布:日本爱知大学怎么样 编辑:程序博客网 时间:2024/05/08 16:44

G codes

Codes and commands ››
ParentPreviousNext

The following tables will give a brief explanation to the various G, M and other codes recognized by the CNCSimulator interpreter. In the Format column, you will see the format expected by the program. If a code is written within brackets like this [X#] it means that the code is non obligatory and can be omitted if not needed. The # sign means that the CNCSimulator expects a number and the $ sign means that it is expecting a text string within quotation marks.


Let's show an example:

G12[X#][Y#]Z#R#Q#S#SA#AS#RA#H#


This means that the code G12 accepts X and Y coordinates but they are not obligatory and can be omitted. On the other hand, you must specify the Z,R,Q,S,SA,AS,RA and H codes to avoid an alarm at runtime.

G-code

(codes valid from V1.0.6.5)

Explanation

Format

Example

Machine type

G0 or G00

Go rapidly (with maximum traverse rate) to the X/Y/Z position. This code is used for position and not for actual machining.

G0 [X#][Y#][Z#]

G0 Z100

All machines

G1 or G01

Travel in a straight line using the programmed feed rate (F). This code is used for machining.

G1 [X#][Y#][Z#][F#]

G1 X2.5Y4.1 F200

All machines

G2 or G02

XY-machines

Lathe

Circular/Helical Interpolation clockwise. It causes a clockwise circular movement at programmed feed rate (F). The motion can be 2-dimensional (flat) or 3-dimensional (helical). The default plane of the circular movement is the XY-plane (G17) but other planes can be used as well (see G17-G19). The center of the arc or circle is programmed using the I, J and K letters (R can also be used).

G2[X#][Y#][Z#]

[I#][J#][K#][R#][F#]

G2 X10Y10 I10J0 F200

All machines

G3 or G03

XY-machines

Lathe

Exactly like G2 but the circular motion is going counterclockwise.

G3[X#][Y#][Z#]
[I#][J#][K#][R#][F#]

G3 X10Y10 I10J0 F200

All machines

G4

Dwell in milliseconds. This will keep the axes unmoving for the period of timed specified by the P number.

G4 P#

G4 P2000(Two seconds delay)

All machines

G12

Circular drilling canned cycle. Use to drill holes around the contour of a circle. R is starting plane and Z is total drill depth for each hole. Q is incremental depth (peck). SA is circle start angle (angle of first hole too) and AS is angle between holes. RA is circle radius and H specifies the number of holes to drill.

G12[X#][Y#]Z#
R#Q#S#SA#
AS#RA#H#

G12 X0Y0 Z-20R2 Q5SA0 AS36 RA30 H10

Milling machines only

G17

Selects the XY plane for circular movements (see G2 and G3).

G17

G17

Milling machines only

G18

Selects the XZ plane for circular movements (see G2 and G3)

G18

G18

Milling machines only

G19

Selects the YZ plane for circular movements (see G2 and G3)

G19

G19

Milling machines only

G28

Return home command. This command will first go to the programmed position X/Y/Z and then to the Xmin Ymax Zmax of the machine axes. It can be a convenient way to end a program putting the machine table in a position to change workpiece.

G28[X#][Y#][Z#]

G28 Z10

Milling and turning machines only

G40

Cancel cutter compensation previously activated by G41 or G42.

G40

G40

All machines except the 3D Printer

G41

Activates left side cutter compensation (or nose radius compensation in a lathe).

G41

G41

All machines except the 3D Printer

G42

Activates right side cutter compensation (or nose radius compensation in a lathe).

G42

G42

All machines except the 3D Printer

G54-G59

Fixture (work) offsets. A typical use of these G-codes is to establish a local coordinate system for each workpiece when using multiple ones. You need to setup the offsets in the Zero Points Data table in the Inventory Browser (F2).

G54 corresponds to offset registry index 0, G55 to index number 1 etc…

G54

G0 G54X0 Y0Z3

All machines

G54.1

Fixture (work) offsets. A typical use of these G-codes is to establish a local coordinate system for each workpiece when using multiple ones. You need to setup the offsets in the Zero Points Data table in the Inventory Browser (F2).

G54.1 uses letter P to specify the offset registry index.

G54.1 P# (0-99)

G54.1 P10(Use work offset 10)

All machines

G73

Peck drilling canned cycle. The cycle is intended for deep drilling or chip breaking milling operations. The cycle retracts the tool to break chips. Code letter Q is used for peck size. R is starting plane and Z is total depth. Parameter P is used for dwell at each peck. Please note that at the end of the cycle, the return position in Z is controlled by G98 and G99.

G73 [X#][Y#][Z#]
[R#][Q#][P#]

G73 Z-20R1 Q1P100

Milling and turning machines only

G74-G76

Generic drilling/boring/tapping canned cycle. These are used in a generic way to create compatibility with many common CNC controllers on the market. They will bring the tool to the programmed Z depth. If R is programmed it will be used as the start plane, if not the current Z position will be used as the start plane. All other parameters will be ignored.

G74 [X#][Y#][Z#][R#]

G74 Z-20R1

Milling and turning machines only

G80

Cancels any canned cycle. Please note that G0 – G3 also cancels canned cycles.

G80

G80

Milling and turning machines only

G81

Basic drilling canned cycle. R is starting plane and Z is total depth. Please note that at the end of the cycle, the return position in Z is controlled by G98 and G99.

G81 [X#][Y#][Z#][R#]

G81 Z-6R2

Milling and turning machines only

G82-G89

Generic drilling/boring/tapping canned cycle. Same as G74-G76 above.

G82 [X#][Y#][Z#][R#]

G82 Z-20R1

Milling and turning machines only

G90

Absolute programming mode. Distances given will move the tool relative to an absolute zero.

G90

G90 G0X10 Y10

All machines

G91

Incremental programming mode. Distances given will move the tool relative to the current position of the tool.

G91

G91 G0Z5

All machines

G92

Use to reposition the origin point (zero point).

G92[X#][Y#][Z#]

G92 X20Y20 Z10

All machines

G98

Initial level return at the end of a canned cycle.

G98

G81 G98  Z-7R2

Milling and turning machines only

G99

R level return at the end of a canned cycle.

G99

G81 G99  Z-7R2

Milling and turning machines only



Created with the Personal Edition of HelpNDoc:Easy EBook and documentation generator

原创粉丝点击