Concept Flow - G-code program structure
Start Program
Initialize Settings
Execute Commands
Check for End
Next Command
The G-code program starts, sets up machine parameters, runs commands step-by-step, and ends when the program finishes.
N10 G21 (Set units to mm)
N20 G90 (Absolute positioning)
N30 G01 X50 Y25 F100 (Move linearly to X50 Y25 at feed 100)
N40 M30 (End program)| Line Number | Command | Action | Machine State | Output |
|---|---|---|---|---|
| N10 | G21 | Set units to millimeters | Units=mm | Units set to mm |
| N20 | G90 | Set absolute positioning mode | Positioning=Absolute | Positioning set to absolute |
| N30 | G01 X50 Y25 F100 | Move tool linearly to X=50, Y=25 at feed 100 | Position=(50,25), Feed=100 | Tool moved to X50 Y25 |
| N40 | M30 | End program | Program Ended | Program stopped |
| Variable | Start | After N10 | After N20 | After N30 | After N40 |
|---|---|---|---|---|---|
| Units | Default (inches) | mm | mm | mm | mm |
| Positioning | Default (Incremental) | Incremental | Absolute | Absolute | Absolute |
| Position | (0,0) | (0,0) | (0,0) | (50,25) | (50,25) |
| Feed | Default | Default | Default | 100 | 100 |
| Program State | Not started | Running | Running | Running | Ended |
G-code program structure: - Start with program setup (units, positioning) - Execute movement and machine commands line by line - Use N numbers for line labels - End program with M30 - Commands affect machine state stepwise