Good day Back at it again.
The Avid Mach4 button set the z height between cuts…but at the end the z will rise all the way up and it is wasted time.
It seems the parking settings work for the x and y but the z gets bypassed by the post processor. >End program Z park
In this youtube video this guy Avid plasma behaves like it should
4’x4’ Cnc Plasma Table ~ Avid Pro Cnc Plasma Kit (youtube.com)
but mine raise all the way up…almost to the homing z position.
So the question is of the 2 options how would I change this in the postprocessor not to rise all the way up, or let sheetcam decide on the parking position of the z? Thank you!
I can’t program to save my life but trying here
++++++++++++++++++++++++++++++++++++++++++++++++++++
– Post processor version
local postVersion = “1.9.1”
local minToolsetVersion = “v1.7.3.7”
local minMach4Version = “2.4.0”
– Custom post option defaults (mm, mm/min)
local refDistanceDefault = 0
local refFeedDefault = 500
local slowProbeDefault = 6.35
local touchOffTypeDefault = 0
local endZparkDefault = -12.7
– AntiDive defaults (fallback if not in gcode)
local targetTipVoltDefault = 115
local AD1Default = 0.8
–Torch on and off codes. CHANGE THE P# to match your OUTPUT#!!! P3 is for Output#3, P27 is for Output#27, etc…
torchOnCode = " M62P3"
torchOffCode = " M63P3"
–Code to use when referencing
refCode=" G31.0 Z-100"
function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText(“TMC3in1 and Ethernet SmoothStepper in Mach4\n”)
ctrl:AppendText(“\n”)
ctrl:AppendText(string.format(“Avid CNC post processor version: %s\n”, postVersion))
ctrl:AppendText(string.format(“Minimum Avid CNC Mach4 profile version: %s\n”, minMach4Version))
ctrl:AppendText(string.format(“Minimum AvidCNC Toolset version: %s\n”, minToolsetVersion))
ctrl:AppendText(“\n”)
ctrl:AppendText(“Post variables:\n”)
ctrl:AppendText(“refDistance - set the distance between each reference\n”)
ctrl:AppendText(“refFeed - set the feed rate when referencing\n”)
ctrl:AppendText(“endZpark - set the machine coordinate end point of a final rapid clearance move\n”)
ctrl:AppendText(“slowProbe - set the Z height in Work coordinates where the reference feed rate starts\n”)
local window = ctrl:GetParent()
local btn = wx.wxButton(window, wx.wxID_ANY, “Set custom post options”)
btn:Connect(wx.wxID_ANY, wx.wxEVT_COMMAND_BUTTON_CLICKED, OnButton)
ctrl:GetContainingSizer():Insert(2, btn, 0, wx.wxALL, 5)
end
function OnButton(evt)
post.ShowCustomOptions(“Post settings”)
end
–These appear in Options-Machine->Post processor->Set custom post options
–see the docs for ‘DefineCustomOption’ to see what these values mean.
varDefs={
–The modes used below are 0, 1, 2 and 3:
– 0 = Appears in ‘Options-Machine->Post processor->Set custom post options’ and in a ‘Set post processor variable’ operation
– 1 = Appears in tool definition
– 2 = Appears in ‘Options-Machine->Post processor->Set custom post options’ and in a ‘Set post processor variable’ operation
– 3 = Appears in ‘Options-Machine->Post processor->Set custom post options’ only
– Description, ,variable name , units ,min ,max ,default ,scale, mode
{“Target Tip Volts” ,“TARGET_TIP_VOLTS” , sc.unit2DECPLACE ,50 ,250 , targetTipVoltDefault ,1 ,1},
–{“Target Band Volts” ,“TARGET_BAND_VOLTS” , sc.unit2DECPLACE ,0 ,20 ,1.5 ,1 ,1},
–{“Linear Response Band Above Target Volts” ,“LINEAR_RESPONSE_BAND_VOLTS_ABOVE”, sc.unit2DECPLACE ,0 ,100 ,25.25 ,1 ,1},
–{“Linear Response Band Below Target Volts” ,“LINEAR_RESPONSE_BAND_VOLTS_BELOW”, sc.unit2DECPLACE ,0 ,100 ,15.2 ,1 ,1},
–{“ESS Delay after Arc OK, in Seconds” ,“ESS_DELAY_AFTER_ARC_OKAY” , sc.unit2DECPLACE ,0 ,10 ,0.005 ,1 ,1},
– Description, , variable name , units ,min ,max ,default ,scale, mode
{“Distance between references” , “refDistance” , sc.unitLINEAR ,0 ,1e17 , refDistanceDefault ,1 ,2},
{“Reference feed rate” , “refFeed” , sc.unitFEED ,0 ,1e17 ,refFeedDefault ,1 ,2},
{“Slow Probe Height” , “slowProbe” , sc.unitLINEAR ,0 ,1e17 , slowProbeDefault ,1 ,2},
–{“Extra delay for first pierce” , “firstDelay” , sc.unitTIME ,0 ,1e17 ,0 ,1 ,3},
–{“Mechanical Switch Offset” , “switchoffset” , sc.unitLINEAR ,0 ,1e17 ,2.21 ,1 ,2},
{"Touchoff, 1 = Mechanical 0 = Ohmic " ,“touchOffType” , sc.unit0DECPLACE ,0 ,1 , touchOffTypeDefault ,1 ,2},
{“End program Z park (machine coordinates)” ,“endZpark” , sc.unitLINEAR ,-500 ,0 , endZparkDefault ,1 ,2},
– Description, , variable name , units ,min ,max ,default ,scale, mode
–{“ESS HC Limit Z Max” , “HC_Z_MAX_VALUE” , sc.unitLINEAR ,-1e17 ,1e17 ,25.4 ,1 ,0},
–{“ESS HC Limit Z Min” , “HC_Z_MIN_VALUE” , sc.unitLINEAR ,-1e17 ,1e17 ,-2.54 ,1 ,0},
– Description, , variable name , units ,min ,max ,default ,scale, mode
–{“AD1 Delay after Arc OK ENABLE” , “AD1_DELAY_ENABLED” , sc.unit0DECPLACE ,0 ,1 , 1 ,1 ,0},
{“AD1 Delay after Arc OK Time” , “AD1_DELAY_VALUE” , sc.unitTIME ,0 ,10 , AD1Default ,1 ,1},
–{“AD2 M62/M63, 1 = ENABLE 0 = DISABLE” ,“AD2_M62_M63_ENABLED”, sc.unit0DECPLACE ,0 ,1 ,0 ,1 ,0},
–{“AD3 Velocity ENABLE” ,“AD3_VELOCITY_ENABLED”, sc.unit0DECPLACE ,0 ,1 ,1 ,1 ,0},
–{“AD3 Velocity Percent” ,“AD3_VELOCITY_PERCENT”,sc.unitPERCENT ,0 ,1 ,0.95 ,100 ,0},
–{“AD4 Voltage ENABLE” ,“VOLTAGE_AD_ENABLED”, sc.unit0DECPLACE ,0 ,1 ,0 ,1 ,0},
–{“AD4 ATV Sample Buffer” ,“VOLTAGE_AD_ATV_BUFFER_SIZE” , sc.unitTIME ,0.001,0.8 ,0.8 ,1000 ,0},
–{“AD4 Voltage Precondition Percent” ,“VOLTAGE_AD_PRECONDITION_WINDOW_PERCENT”, sc.unitPERCENT ,0 ,10 ,0.0401 ,100 ,0},
–{“ADR Voltage Throttling Percent” ,“VOLTAGE_AD_AD4_THC_THROTTLING_PERCENT”, sc.unitPERCENT ,0 ,10 ,0 ,100 ,0},
–{“AD5 Inhibit Above Current Tip Volts” ," VOLTAGE_AD_AD5_ATV_PERCENT_ABOVE_CURRENT_TIP_VOLTS" , sc.unit2DECPLACE ,0 ,50 ,15.1 ,1 ,0},
–{“AD6 Inhibit Below Current Tip Volts” ,“VOLTAGE_AD_AD6_ATV_PERCENT_BELOW_CURRENT_TIP_VOLTS” , sc.unit2DECPLACE ,0 ,50 ,14.4 ,1 ,0},
}
for i, def in ipairs(varDefs) do
local mode = def[8]
if(mode == 1) then
post.DefineCustomToolParam(“PlasmaTool”, def[1],def[2],def[3],def[6],def[4],def[5])
else
post.DefineCustomOption(def[1],def[2],def[3],def[4],def[5],def[6])
if mode < 3 then
post.DefineVariable(def[2],def[3],def[4],def[5])
end
end
end
varVals={}
function CheckOptions()
local found = false;
for i, def in ipairs(varDefs) do
local varName = def[2]
if(_G[varName] ~= varVals[varName] and def[8] < 2) then
varVals[varName] = _G[varName]
found = true
local mult = def[7]
if(def[3] == sc.unitLINEAR) then mult = mult * scale end
post.Text(" m2020 (“, varName,”=“)
post.Number(_G[varName] * mult, “0.##”)
post.Text(”)\n");
end
end
– Pierce delay
if (lastPierceDelay ~= pierceDelay) then
lastPierceDelay = pierceDelay
post.Text(" m2020 (ESS_DELAY_AFTER_ARC_OKAY=", pierceDelay, “)\n”)
found = true
end
if found then
post.Text(" G4 P0.1\n")
end
end
function OnInit()
varVals={}
offX = 0
offY = 0
offZ = 0
restartCount = 1
lastPierceDelay = pierceDelay
wasReferenced = false
–post.TextDirect(“%\n”)
– Radial reference distance check variables
refX = 0
refY = 0
post.SetCommentChars (“()”, “”) --make sure ( and ) characters do not appear in system text
post.Text (" (Filename: “, fileName, “)\n”)
post.Text (” (Post processor: “, postName, " v”, postVersion, “)\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 G91.1 G40\n")
– post.Text (" G61 (Exact Stop Mode - NOT normally used with Plasma)\n")
post.Text (" G64 (Constant Velocity Mode - normally used with Plasma)\n")
minArcSize = 0.2 --arcs smaller than this are converted to moves
firstRef = true
currentZAxis = “Z”
CheckOptions()
end
function OnNewLine()
post.Text (“N”)
post.Number (lineNumber, “0000”)
lineNumber = lineNumber + 10
end
function OnFinish()
endZ = safeZ + 0.1 --force a Z move to guarantee turn torch off
OnRapid()
post.ModalText(" G53")
post.ModalText(" G00")
post.ModalNumber(" Z", endZpark * scale, “0.0000”) --lifts to the specified machine coordinate
post.Eol()
post.ModalText(" G90")
post.Eol()
post.Text(" M30\n")
post.TextDirect(“%\n”)
end
function OnRapid()
if (endX > 1e17 and endY > 1e17) then return end
local len = math.hypot((endX + offX)-currentX , (endY + offY)-currentY)
if (len < 1e-17) and (((endZ + offZ)-currentZ) < 1e-17) then return end
post.ModalText (" G00")
post.ModalNumber (" X", (endX + offX) * scale, “0.0000”)
post.ModalNumber (" Y", (endY + offY) * scale, “0.0000”)
---------normal Z rapid moves removed. All upward rapid moves will be handled by M3000
post.Eol()
end
function OnMove()
local len = math.hypot(endX - currentX , endY - currentY)
– always clearing work shift at final cut height
if (not wasReferenced) then
post.ModalText(" G01")
post.ModalNumber(" " … currentZAxis, (cutHeight + offZ) * scale, “0.0000”)
post.ModalNumber (" F", feedRate * scale, “0.0###”)
post.Eol()
post.Text(" M3001 (Clear work shift)\n")
wasReferenced = true
end
post.ModalText (" G01")
post.ModalNumber (" X", (endX + offX) * scale, “0.0000”)
post.ModalNumber (" Y", (endY + offY) * scale, “0.0000”)
if(offZ) then
post.ModalNumber (" " … currentZAxis, (endZ + offZ) * scale, “0.0000”)
end
post.ModalNumber (" F", feedRate * scale, “0.0###”)
post.Eol()
end
function OnArc()
local radius = math.hypot(currentX - arcCentreX, currentY - arcCentreY)
if(arcAngle <0) then
post.ModalText (" G03")
else
post.ModalText (" G02")
end
post.ModalNumber (" X", (endX + offX) * scale, “0.0000”)
post.ModalNumber (" Y", (endY + offY) * scale, “0.0000”)
if(offZ) then
post.ModalNumber (" " … currentZAxis, (endZ + offZ) * scale, “0.0000”)
end
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()
wasReferenced = false
– Small incremental move to execute code snippets
post.ModalText(" G00")
post.ModalText(" G91")
post.Text(" Z")
post.Number (-(scale)*.1 , “0.0000”) --force a small move
post.Eol()
post.ModalText(" G90")
post.Eol()
– Restart point
post.Text(string.format(" (<<<<<<<<<<<<<<<<RESTART POINT #%s>>>>>>>>>>>>>>>>)\n", restartCount))
restartCount = restartCount + 1
– Reference
if firstRef then
Reference()
else
– Ref distance check.
local refCurrentDistance = math.hypot((currentX - refX), (currentY - refY))
if (refCurrentDistance > refDistance) then
Reference()
end
end
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 G4 P0.002\n”, torchOnCode, " \n")
post.ModalText (" G00")
post.Text(" Z")
post.Number ((pierceHeight * scale) - 0.001 , “0.0000”) --force a small move
post.Eol()
end
function Reference()
–check for first probe in this function and do a slow probe on first probe
if firstRef then --this section just does a full slow probe
post.ModalText(refCode)
post.ModalNumber (" F", refFeed * scale, “0.0###”)
post.Eol()
else --this section moves rapid to slowProbe Z height then probes slow
post.Text(" G00 Z")
post.Number(slowProbe*scale, “0.0000”)
post.Eol()
post.ModalText(refCode)
post.ModalNumber (" F", refFeed * scale, “0.0###”)
post.Eol()
end
firstRef = false
wasReferenced = true
refX = currentX
refY = currentY
-- Restart point moved to OnPenDown() so that every start is a restart point
if (touchOffType == 1) then
– Mechanical touch off
post.Text(" M3003 (Zero Z Axis - Mechanical)\n")
else
– Ohmic touch off
post.Text(" M3002 (Zero Z Axis - Ohmic)\n")
end
– Macro to clear work shift that had accounted
– for THC movement that wasn’t synced to Mach4.
– After a probe move the THC movement is synced
– back to Mach4.
post.Text(" M3001 (Clear work shift)\n")
– Tell the ESS we zero’d the Z so it can update
– for min/max Z (if enabled in ESS).
post.Text(" m2020 (HC_WORK_Z_ZEROED=1)\n G4 P0.1\n")
end
function OnPenUp()
post.Text (torchOffCode, “\n”)
if (endDelay > 0) then
post.Text (" G04 P")
post.Number (endDelay,“0.###”)
post.Eol()
end
– Motion after torchOffCode
post.ModalText(" G91")
post.ModalText(" G00")
post.ModalNumber(" Z", 0.5 * scale, “0.0000”)
post.Eol()
post.ModalText(" G90")
post.Eol()
– Macro to account for possible THC movement
– that has not been synced back to Mach4.
post.Text(" M3000 (Set work shift)\n")
end
function OnNewOperation()
post.Text (" (Operation: ", operationName, “)\n”)
CheckOptions()
end
function OnToolChange()
CheckOptions()
end
function OnNewPart()
post.Text(" (Part: “,partName,”)\n");
end
function OnComment()
post.Text(" (“,commentText,”)\n")
end
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++