function OnAbout(event) ctrl = event:GetTextCtrl() ctrl:AppendText("Modal G-codes and coordinates\n") ctrl:AppendText("Comments enclosed with ( and )\n") ctrl:AppendText("M03/M05 turn the torch on/off\n") ctrl:AppendText("Incremental IJ - set in mach3\n") ctrl:AppendText("The torch is referenced at cut start and every 500mm of movement thereafter\n") end --Post variables: --refdistance - sets the distance between each reference (default is 500mm) --switchoffset - sets your net switch offset amount (actual measured switch offset on your table) --zrefslowdown - sets your distance that the Z uses ref-speed on the touch off. If larger than the Rapid Height it uses Rapid Height -- modified 8/27/2012 by Jordan Adair -- Based on plasma1.post 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 (" G53 G90 G40\n F1\n") post.Text (" M126\n") --NOTE: Variable numbers below are in MM and are converted to INCHES by the scale factor dist = 9999999 refdistance = 2 * scale zrefslowdown =12.7 * scale lastz = 0 if(zrefslowdown > safeZ * scale) then zrefslowdown = safeZ * scale end end function OnNewLine() post.Text ("N") post.Number (lineNumber, "0000") lineNumber = lineNumber + 10 end function OnFinish() endZ = safeZ OnRapid() endX = 0 endY = 0 OnRapid() post.Text (" M05 M30\n") end function OnRapid() dist = dist + math.hypot(endX-currentX , endY-currentY) post.ModalText (" G00") post.ModalNumber (" X", endX * scale, "0.0000") post.ModalNumber (" Y", endY * scale, "0.0000") post.ModalNumber (" Z", safeZ * scale, "0.0000") post.Eol() end function OnMove() dist = dist + math.hypot(endX-currentX , endY-currentY) post.ModalText (" 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.###") post.Eol() end function OnArc() dist = dist + math.hypot(endX-currentX , endY-currentY) 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.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(dist >= (refdistance/scale)) then dist = 0 post.Text (" M101\n") post.ModalText (" G00") post.ModalNumber (" Z", pierceHeight * scale, "0.0000") else post.ModalText (" G00") post.ModalNumber (" Z", pierceHeight * scale, "0.0000") post.Eol() end if (preheat > 0) then post.Text ("\n G04 P") post.Number (preheat,"0.###") post.Eol() end post.Text ("\n M03\n") post.Eol() if (pierceDelay > 0) 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 (" (Process: ", operationName, ")\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 OnToolChange() post.Text (" M06 T") post.Number (tool, "0") post.ModalNumber(" F",feedRate * scale,"0.#") post.Text (" (", toolName, ")\n") end function OnNewPart() post.Text(" (Part: ",partName,")\n"); end