function OnAbout(event) ctrl = event:GetTextCtrl() ctrl:AppendText("Go Fab CNC Plasma Post Processor\n") ctrl:AppendText("\n") ctrl:AppendText("Go Fab CNC Controls Parameters such as Piercing and feed rates\n") end post.ForceExtension("ngc") 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 ("G90 (absolute coordinates)\n") bigArcs = 1 --stitch arc segments together minArcSize = 0.05 --arcs smaller than this are converted to moves end function OnFinish() end function OnRapid() if(math.hypot(currentX - endX, currentY - endY) < 0.0001) then return end post.Text ("G00") post.ModalNumber (" X", endX * scale, "0.0000") post.ModalNumber (" Y", endY * scale, "0.0000") -- post.ModalNumber (" Z", endZ * scale, "0.0000") post.Eol() end function OnMove() if(math.hypot(currentX - endX, currentY - endY) < 0.0001) then return end post.Text ("G01") post.ModalNumber (" X", endX * scale, "0.0000") post.ModalNumber (" Y", endY * scale, "0.0000") -- post.ModalNumber (" Z", endZ * scale, "0.0000") -- post.ModalNumber (" F", feedRate * scale, "0.0###") post.Eol() end function OnArc() post.ArcAsMoves(0.1) --[[ if(arcAngle <0) then post.Text ("G03") else post.Text ("G02") end post.NonModalNumber (" X", endX * scale, "0.0000") post.NonModalNumber (" Y", endY * scale, "0.0000") -- post.ModalNumber (" Z", endZ * scale, "0.0000") post.Text (" I") post.Number ((arcCentreX - currentX) * scale, "0.0000") post.Text (" J") post.Number ((arcCentreY - currentY) * scale, "0.0000") -- post.ModalNumber (" F", feedRate * scale, "0.0###") post.Eol()]] end function OnPenDown() --[[ if (preheat > 0.001) then post.Text (" G00") post.ModalNumber (" Z", cutHeight * scale, "0.0000") post.Text ("\n G04 P") post.Text " (pause)" post.Number (preheat,"0.###") post.Eol() end post.Text (" G00") post.ModalNumber (" Z", pierceHeight * scale, "0.0000") post.Text ("\n M03 (turn on plasma)\n") if (pierceDelay > 0.001) then post.Text (" G04 P") post.Text " (pause)" post.Number (pierceDelay + firstPierce,"0.###") firstPierce = 0 post.Eol() end]] post.Text ("G01 M03 (turn on plasma)\n") end function OnPenUp() --[[ post.Text (" M05 (turn off plasma)\n") if (endDelay > 0) then post.Text (" G04 P") post.Text " (pause)" post.Number (endDelay,"0.###") post.Eol() end]] post.Text ("G01 M05 (turn off plasma)\n") end function OnNewOperation() post.Text ("(Operation: ", operationName, ")\n") end function OnComment() post.Text("(",commentText,")\n") end function OnToolChange() post.Text ("(", toolName, ")\n") --[[ post.Text (" M06 T") post.Number (tool, "0") post.ModalNumber(" F",feedRate * scale,"0.0###") post.Text (" (", toolName, ")\n") if (plungeRate <= 0) then post.Warning("WARNING: Plunge rate is zero") end if (feedRate <= 0) then post.Warning("WARNING: Feed rate is zero") end]] end function OnNewPart() post.Text("(Part: ",partName,")\n"); end function OnDrill() OnRapid() OnPenDown() endZ = drillZ OnMove() OnPenUp() endZ = safeZ OnRapid() end