I upgraded firmware on my PMDX 411 and am now having issues in regards to M6 command. When I debug it works fine, but when I run it as a command it gets stuck on "mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")" The command executes, but instead of going to Z0.0, it gets close .047ish. If i manually do am MDI "G90 G53 G0 Z0.0" it goes to where it needs to no problem. I did a debug and attached it. I see it is waiting for a motor 2 to stop, which it doesn't get. then an odd thing happens a few seconds later where I get a "Signal id 1123, (machine coord), changed from Low to High"
Just guessing here, but it seems that the probe function was tying up the command some how. I put ">>>>" where it is hanging up. I do get an occasional stop when the probe touches the plate and it just stays there instead of continuing. may be related, but one thing at a time.
Any help would be appreciated.
function m6()
local inst = mc.mcGetInstance();
local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = mc.mcToolGetCurrent(inst)
local hsig = mc.mcSignalGetHandle(inst, mc.ISIG_PROBE)
local changetoo = mc.mcToolGetDesc(inst,selectedtool)
local toollen = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool)
--your machine info custom to you
local touchplate = -.195 -- this is the height above or below table surface for non flush touchplates.
local longesttool = 6 -- this is the longest bit that you own that you could possibly use
local zclearance = -11.375 -- this is the measurment from your collet to the fixed touchplate
local probeclearance = .5 -- this is safe distance above touchplate where you want probe to start
-- end of your machine info
local undefinedtoolprobe = (zclearance + longesttool +touchplate + probeclearance )
local undefinedprobetravel = (zclearance + longesttool + touchplate)
local probestart = (zclearance + toollen + probeclearance +touchplate)
if selectedtool == currenttool then
mc.mcCntlSetLastError(inst, "ToolChange Activated But Not Required")
else
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0") --move z axis all the way up
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X0.464 Y-98.25") -- Move XY to above fixed touchplate location change to match your machine
mc.mcCntlGcodeExecuteWait(inst, "G49") -- Cancels any current offsets
if toollen ~= 0 then -- if toollen is defined in tool table do this
wx.wxMessageBox("Please change to tool "..selectedtool.." which is a "..changetoo.."")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G1 Z"..probestart.." f25\n G91 G31 Z-1.25 F6") -- change "F#" to vary probing speed
ProbeState = mc.mcSignalGetState(hsig)
if ProbeState == 0 then -- if probe is not sensed this prevents a false zero from being utilized.
mc.mcCntlSetLastError(inst, "ERROR: Touch Probe was not detected")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
wx.wxMessageBox("ERROR: Touch Probe was not detected reset tool")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G1 Z"..probestart.." f25\n G91 G31 Z-1.25 F6")-- change "F#" to vary probing speed
ProbeState = mc.mcSignalGetState(hsig)
if ProbeState == 0 then -- no probe detected end cycle
mc.mcCntlSetLastError(inst, "ERROR: Touch Probe was not detected")
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
wx.wxMessageBox("ERROR: Touch Probe was not detected Cycle stopped")
mc.mcCntlCycleStop(inst)
else
local zoffset = mc.mcAxisGetPos (inst, 2) - touchplate
mc.mcToolSetData (inst, mc.MTOOL_MILL_HEIGHT, selectedtool, zoffset)
mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
mc.mcCntlSetLastError(inst, "ToolChange Finished")
mc.mcToolSetCurrent(inst, selectedtool)
end
else
local zoffset = mc.mcAxisGetPos (inst, 2) - touchplate
mc.mcToolSetData (inst, mc.MTOOL_MILL_HEIGHT, selectedtool, zoffset)
>>> mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
mc.mcCntlSetLastError(inst, "ToolChange Finished")
mc.mcToolSetCurrent(inst, selectedtool)
end
else
wx.wxMessageBox("Tool Length is not Defined in Tool Table.\nset tool length manually and cycle start")
mc.mcCntlCycleStop(inst)
end
end
mc.mcCntlGcodeExecuteWait(inst, "G43") --Turns on Offsets
end
if (mc.mcInEditor() == 1) then
m6()
end