What is the rules of G code?
The rules of G code are typically defined by the machine's control system and may vary depending on the specific machine and its capabilities. However, there are some general rules that are commonly followed when programming G code for CNC machines:
- G code commands are typically written in all capital letters.
- Each command must be preceded by a letter "G" or "M" to indicate the type of command (e.g. G01 for a linear move, M03 for turning on the spindle).
- Each command must be followed by a numerical value or values that specify the parameters of the command (e.g. G01 X10 Y20 Z30 for a linear move to the position X=10, Y=20, Z=30).
- Coordinates are typically specified in terms of X, Y, and Z axis values, with the origin being the home position of the machine.
- G code commands must be separated by a space or line break.
It is important to note that G code is a very detailed and precise programming language, and it is essential to follow the rules and syntax of the language accurately in order to ensure that the CNC machine executes the program correctly.