Foam-cutting G-code is simpler than milling G-code — there is no spindle, no tool changes, no depth passes. But it has its own conventions, mostly around controlling the hot wire.
The hot wire is an output
The wire is switched like a coolant/accessory output: M8 turns it on, M9 turns it off. A program brackets each cutting run with M8…M9 so the wire is only hot while it is actually cutting, and cold during rapid repositioning. Some setups also use an S value to set a wire-temperature/PWM target.
Pre-heat dwell
Right after M8, a G4 P<seconds> dwell pauses motion so the wire reaches temperature before it starts moving — otherwise it drags and marks the entry. cncfoam.com emits this automatically from your Pre-heat (ms) setting.
Feedrate is wire speed
In foam cutting the F feedrate is your cut quality control: it is how fast the wire moves through the foam (see Wire, temperature & feedrate). cncfoam.com applies your chosen feedrate to every cutting move, overriding whatever was in a source file, so the machine cuts at the speed you set.
A typical program structure
; cncfoam.com — generated
G90 G17 G21 ; absolute, XY plane, millimetres
G92 X0 Y0 U0 V0 ; set current position as zero
G0 X.. Y.. U.. V.. ; rapid to start (wire off)
M8 ; hot wire ON
G4 P0.70 ; pre-heat dwell 700 ms
G1 X.. Y.. U.. V.. F400 ; cut...
... ; (the contour)
M9 ; hot wire OFF
G0 ... ; rapid home
M30 ; end
No homing? No problem
Most hobby foam cutters have no endstops; you jog the wire to your start position by hand. cncfoam.com has a "Machine has no homing switches" mode that omits the G92 zeroing line, so the controller keeps whatever zero you set manually, and shows a reminder banner to jog to your work-zero before running.
G92 only declares the current position as zero — it does not physically move the machine. Skipping it is safe when your controller already establishes its own work-zero.