--************************************************ --*** Set these values up to suit your machine *** --************************************************ --this is the reference feed rate in mm/min refFeed = 500 --If this value is set to true then use touchoff subroutine in CommandCNC --Set it to false if you are not running CommandCNC extTOff = true --Put your switch offset value here in MILLIMETRES switchOffset = 1.5 -- do not change the following values unless you are told to do so by an experienced LinuxCNC user or vendor of your controller or table toolTrack = .254 -- Default .254 mm. This is the blending tolerance in MM (deviation from toolpath) the Path Blending allows. -- Lower numbers favors tight tracking over the defined feedrate (slows down) toolTolerance = .0254 -- Default .0254 mm.T his is the linear tolerance for multiple nodes in the same toolpath. -- Lower numbers cause nodes out of line by less than the toolTolerance amount to be a single line --************************************************ --*** End of settings *** --************************************************ function OnAbout(event) ctrl = event:GetTextCtrl() ctrl:AppendText("plasma THC post processor for pre-piercing\n") ctrl:AppendText("\n") 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") end post.DefineVariable("refFeed",sc.unitFEED,0,1e17) post.DefineVariable("switchOffset",sc.unitLINEAR,-1e17,1e17) 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 (" F10.0\n G53 G90 G40\n") post.Text (" G64 P") post.Number (toolTrack * scale, "0.000") post.Text(" Q") post.Number (toolTolerance * scale, "0.000") post.Text (" (tracking tolerances set to " , toolTrack * scale, ") \n") minArcSize = 0.2 --arcs smaller than this are converted to moves end function OnNewLine() post.Text ("N") post.Number (lineNumber, "0000") lineNumber = lineNumber + 10 end function OnFinish() post.Text (" M05 M30\n") end function OnRapid() post.ModalText (" 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() end function OnArc() end function OnPenDown() Reference(); post.ModalText (" G00") post.Text(" Z") post.Number (pierceHeight * scale, "0.0000") post.Eol() if (preheat > 0) then post.Text ("\n G04 P") post.Number (preheat,"0.###") post.Eol() end post.Text ("\n M03 S100\n") if (pierceDelay > 0) then post.Text (" G04 P") post.Number (pierceDelay,"0.###") post.Eol() end post.Text (" M05\n") if (endDelay > 0) then post.Text (" G04 P") post.Number (endDelay,"0.###") post.Eol() end end function Reference() firstRef = false if (extTOff == true) then -- run the touch off from a stored subroutine post.Text (" o call\n") post.CancelModaltext() post.CancelModalNumbers() else post.Text (" G38.2 Z -100") post.ModalNumber (" F", refFeed * scale, "0.0###") post.Eol() post.ModalText(" G92 Z0.0\n") post.ModalText (" G00") post.Text(" Z") post.Number (switchOffset * scale, "0.0000") post.Eol() post.ModalText(" G92 Z0.0\n") end end function OnNewOperation() post.Text (" (Operation: ", operationName, ")\n") end function OnNewPart() post.Text(" (Part: ",partName,")\n"); end function OnDrill() OnRapid() currentX = endX currentY = endY OnPenDown() endZ = drillZ OnMove() OnPenUp() endZ = safeZ OnRapid() end function OnComment() post.Text(" (",commentText,")\n") end