Here’s the unedited post file
------ Configuration options ------
-- Set this to true if you have the multi-tool option enabled in PlasmaC.
-- If not set it to false
multiTool = false
-- Set this to true if you are using a material file.
-- See http://linuxcnc.org/docs/devel/html/plasma/plasmac-user-guide.html#material-file
-- Set it to false otherwise
materialFile = true
-- Set this to true if you want SheetCam to control the feed rate.
-- Set it to false otherwise
-- NOTE if you use rules to change the feed rate, these changes will affect the
-- feed rate even if useFeed is false
useFeed = true
---- End of configuration options ------
if materialFile then
post.DefineCustomToolParam("PlasmaTool", "Material", "material", sc.unit0DECPLACE, 0,0,1e17)
end
function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText("LinuxCNC plasma post processor\n")
ctrl:AppendText("\n")
ctrl:AppendText("Modal G-codes and coordinates\n")
ctrl:AppendText("Comments enclosed with ( and )\n")
ctrl:AppendText("Incremental IJ\n")
ctrl:AppendText("Does not use Z axis")
ctrl:AppendText("NOTE: These parameters in SheetCam have no effect:")
ctrl:AppendText("Feed rate (optional - see config options)")
ctrl:AppendText("Pierce delay")
ctrl:AppendText("Pierce height")
ctrl:AppendText("Plunge rate")
ctrl:AppendText("Cut height")
end
function OnInit()
post.SetCommentChars ("()", "[]") --make sure ( and ) characters do not appear in system text
post.Text (" (Filename: ", fileName, ")\n")
post.Text (" (Post processor: ", postName, ")\n")
post.Text (" (Date: ", date, ")\n")
if(scale == metric) then
post.Text (" G21 (Units: Metric)\n") --metric mode
else
post.Text (" G20 (Units: Inches)\n") --inch mode
end
post.Text (" G40 G90\n F1 S1\n")
bigArcs = 1 --stitch arc segments together
minArcSize = 0.05 --arcs smaller than this are converted to moves
material = 0
curFeed = 1;
curScale = -1
end
function OnNewLine()
post.Text ("N")
post.Number (lineNumber, "0000")
lineNumber = lineNumber + 10
end
function DoFeed()
if useFeed then
post.ModalNumber (" F", feedRate * scale, "0.###")
else
local scale = feedRate / curFeed
if scale ~= curScale then
curScale = scale
post.Text(" F[#<_hal[plasmac.cut-feed-rate]> * ")
post.Number(scale,"0.###")
post.Text("]")
end
end
end
function OnFinish()
post.Text (" M05 M30\n")
end
function OnRapid()
if(math.hypot (endX - currentX, endY - currentY) < 0.001) then return end
post.ModalText (" G00")
post.ModalNumber (" X", endX * scale, "0.0000")
post.ModalNumber (" Y", endY * scale, "0.0000")
post.Eol()
end
function OnMove()
if(math.hypot (endX - currentX, endY - currentY) < 0.001) then return end
post.ModalText (" G01")
post.ModalNumber (" X", endX * scale, "0.0000")
post.ModalNumber (" Y", endY * scale, "0.0000")
DoFeed()
post.Eol()
end
function OnArc()
if(arcAngle <0) then
post.ModalText (" G03")
else
post.ModalText (" G02")
end
post.NonModalNumber (" X", endX * scale, "0.0000")
post.NonModalNumber (" Y", endY * scale, "0.0000")
post.Text (" I")
post.Number ((arcCentreX - currentX) * scale, "0.0000")
post.Text (" J")
post.Number ((arcCentreY - currentY) * scale, "0.0000")
DoFeed()
post.Eol()
end
function OnPenDown()
--[[ if (preheat > 0.001) then
post.ModalText (" G00")
post.ModalNumber (" Z", cutHeight * scale, "0.0000")
post.Text ("\n G04 P")
post.Number (preheat,"0.###")
post.Eol()
end
post.ModalText (" G00")
post.ModalNumber (" Z", pierceHeight * scale, "0.0000")]]
post.Text (" M03")
if(multiTool) then
if(toolClass == "ScriberTool") then
post.Text(" $1 S1")
else
post.Text(" $0 S1")
end
end
post.Eol()
if (pierceDelay > 0.001) then
post.Text (" G04 P")
post.Number (pierceDelay,"0.###")
post.Eol()
end
end
function OnPenUp()
post.Text (" M05\n")
if (endDelay > 0) then
post.Text (" G04 P")
post.Number (endDelay,"0.###")
post.Eol()
end
end
function OnNewOperation()
post.Text (" (Operation: ", operationName, ")\n")
end
function OnComment()
post.Text(" (",commentText,")\n")
end
function OnNewPart()
post.Text(" (Part: ",partName,")\n");
end
function OnToolChange()
curFeed = feedRate
if(material > 0 and materialFile) then
post.Text(" M190 P", material, "\n")
post.Text(" M66 P3 L3 Q1\n")
end
end
function OnDrill()
OnRapid()
if(multiTool and toolClass ~= "ScriberTool") then
post.Text(" M3 $2 S1\n")
else
OnPenDown()
OnPenUp()
end
end