Hi All
I am currently editing a GRBL post processor to run a laser. I am trying to pull in the tool type to build my code but am not having much luck. I can get the operationName with this snippet
post.Text (" /*OPERATION ", operationName, " */ \n")
The output in gcode is /*OPERATION Laser engrave, Layer 1, T18: Laser, 1.5 mm kerf, 0 mm Deep */
This will change for each tool and the layer name.
Is there a way to extract the first part of the string up to the comma so it only outputs "Laser engrave"?
I have tried several things but new to editing post processors so need some help.
Thanks
GRBL Laser Post Processor
Re: GRBL Laser Post Processor
try this snippet, it worked for me in some test cases this morning...
SC post processors are written in a language named Lua, here is the reference doc: https://www.lua.org/manual/5.1/manual.html#5.4
Happy coding
Code: Select all
-- test code
-- match any char from begining of string to comma and return that substring
local s = string.match ( operationName, "^.-," )
if s~= nil then
-- remove the comma at the end
s = string.sub ( s, 1, string.len(s) - 1 )
post.Text ( s, "\n" )
else
post.Text ( "no comma found \n" )
end
Happy coding
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
Re: GRBL Laser Post Processor
That is exactly what I was looking for
thanks
thanks
Re: GRBL Laser Post Processor
There should be a built in variable for the tool name. Not sure what it's called. Look at the variable monitor in SheetCam and you should see it.