function OnAbout(event) ctrl = event:GetTextCtrl() ctrl:AppendText("myCNC plsama post processor\n") ctrl:AppendText("\n") ctrl:AppendText("\n") ctrl:AppendText("Modal G-codes and coordinates\n") ctrl:AppendText("Comments use ()\n") ctrl:AppendText("Incremental IJ\n") ctrl:AppendText("Pierce delay is set in the control\n") end post.ForceExtension("nc") function OnInit() post.TextDirect("%\n") 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 ("G17 G40 G90 G91.1\n") bigarcs = 1 --stitch arc segments together minArcSize = 0.2 --arcs smaller than this are converted to moves end function OnFinish() post.Text ("M30\n") post.TextDirect("%\n")end function OnRapid() if (math.hypot(endX - currentX, endY - currentY) < 0.001) then return end if(endX > 1e30) then return end post.ModalText ("G00") post.ModalNumber ("X", endX * scale, "0.0###") post.ModalNumber ("Y", endY * scale, "0.0###") 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.0###") post.ModalNumber ("Y", endY * scale, "0.0###") post.ModalNumber ("F", feedRate * scale, "0.##") post.Eol() end function OnArc() if(arcAngle <0) then post.ModalText ("G03") else post.ModalText ("G02") end post.ModalNumber ("X", endX * scale, "0.0###") post.ModalNumber ("Y", endY * scale, "0.0###") post.Text ("I") post.Number ((arcCentreX - currentX) * scale, "0.0###") post.Text ("J") post.Number ((arcCentreY - currentY) * scale, "0.0###") post.ModalNumber ("F", feedRate * scale, "0.0##") post.Eol() end function OnPenDown() if(toolClass == "MarkerTool") then post.Text ("M72\n") else post.Text ("M71\n") end end function OnPenUp() if(toolClass == "MarkerTool") then post.Text ("M73\n") else post.Text ("M74\n") end if (endDelay > 0) then post.Text ("G04 P") post.Number (endDelay,"0.0##") post.Eol() end end function OnDrill() OnRapid() post.Text("M7\n") end function OnNewOperation() post.Text ("(Operation: ", operationName, ")\n") if (feedRate <= 0) then post.Warning("WARNING: Feed rate is zero") end end function OnComment() post.Text("(",commentText,")\n") end function OnToolChange() end function OnNewPart() post.Text("(Part: ",partName,")\n") end