@kresol You just treat the laser as a CNC spindle. The S value (usually from 0-255 but the Eleks firmware uses 0-1000) controls the power, after you turn it on with the M3 command.

This code will draw a small 10 mm box at full power using default firmware - change the S255 to S1000 for Eleks firmware.

M03 S0
X10 Y10 M03 S255 F1000
X10 Y0 M03 S255 F1000
X0 Y0 M03 S255 F1000
X0 Y10 M03 S255 F1000
M03 S0
M05