Hello Guest it is March 28, 2024, 05:14:35 AM

Author Topic: M6 not updating Current Tool info.  (Read 596 times)

0 Members and 1 Guest are viewing this topic.

M6 not updating Current Tool info.
« on: April 26, 2020, 04:10:40 PM »
This topic has been beaten to death, but for the life of me I can't seem to fix this problem. On T5 M6 (where T on M6 line is tool to use), the tool number in the Current Tool Information box does not change. Actually, it doesn't change either if I switch T to be next tool. The problem persists whether I use upper or lower case M. Here's the standard script from the editor.

When I enter a G43 H5 command, the H offset changes correctly to Tool #5's, but the tool number is stuck at my touch off tool.

What's missing?

Joe



function m6()

   local inst = mc.mcGetInstance()
   local selectedtool = mc.mcToolGetSelected(inst)
   local currenttool = mc.mcToolGetCurrent(inst)
   
   if selectedtool == currenttool then
      mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
   else
      --Remove this line if you would not like the Z axis to move
      --mc.mcCntlGcodeExecute(inst, "G90 G53 G0 Z0.0");--Move the Z axis all the way up
      mc.mcCntlToolChangeManual(inst, true);
      mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedtool) .. "   Previous Tool == " .. tostring(currenttool))
      mc.mcToolSetCurrent(inst, selectedtool)
   end
end

if (mc.mcInEditor() == 1) then
 m6()

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: M6 not updating Current Tool info.
« Reply #1 on: April 26, 2020, 06:44:19 PM »
Lathe or mill?
Without engineers the world stops
Re: M6 not updating Current Tool info.
« Reply #2 on: April 26, 2020, 08:00:01 PM »
Hi Graham,

This is for a mill.

Joe