Post processor Operation M code

i am trying to set up a laser cutter/laser engraving machine .

most of the parts have both cutting and engraving operations , with deferent laser power “Watts”

so what i would like my G_code to look like is this :

(Process: Laser engrave, CUTTING, T10: Laser Engraving, 0 mm Deep)
(Laser Power) M100
G00X53.1648Y25.0006
X3.1648
M07
G01X0.0008F48000
M08
G00X-49.9992
Y20.0006


(Process: Outside Offset, CUTTING, T20: Laser Cutting 4mm Pap)
(Laser Power) M200
G00X30.0632Y10.4452
M07
G01Y5.1001F1000
G02X24.4956Y2.8503I-6.0044J6.8453F1000.0
G01X23.2059Y2.9579F1000



i have tried doing some thing like this in the post processor

function OnNewOperation()
post.Text (" (Process: “, operationName, “)\n”)
if (” Process: " = " Laser engraving “) then
post.text (” M100 ")
end
if (feedRate <= 0) then
post.Warning(“WARNING: Feed rate is zero”)
end
end

but its not working :frowning:


anybody knows how to do this ?

I’m not real sure on this, it’s been a very long time since I’ve done any coding, but maybe you need a line something like this:

If operationName = “Laser engraving” then

The operationName may need to be the entire line that the post.Text prints out.

My best guess, Steve