Hello Guest it is May 11, 2021, 04:44:08 PM

Author Topic: Mach 4 Bug showing in M6 Script  (Read 3374 times)

0 Members and 1 Guest are viewing this topic.

Offline Bx3mE

*
  •  68 68
    • View Profile
Mach 4 Bug showing in M6 Script
« on: December 15, 2016, 07:15:15 AM »
I am experiencing wired behaviour in Mach 4

Im trying out the M6 command and have rewritten DTG:s M6 Script to suit my needs.
Problem is I am getting the wrong value in my script from "mc.mcToolGetSelected(inst)"
M6 Script outline:
Code: [Select]
function M6()
    local inst = mc.mcGetInstance();
    local changeToTool = mc.mcToolGetSelected(inst)
    local changeFromTool = mc.mcToolGetCurrent(inst)

   wx.wxMessageBox("ToolChange from T"..changeFromTool.." to T"..changeToTool.." Press OK to run M6 script")

Workflow:
1) Start Mashine
2) Start Mach4
3) Select Screen (wxRouterSet - Copy)
4) Enter number of the tool in the mashine into toolinformation/CurrentTool textfield (10)
5) Ref all home
6) Jog to where i want to set work Zero
7) Press zero X, Y ,Z
8) Run G-Code:

G21 G90 G64 G40
G0 Z10.0
T10 M6

The message bow that pops up Says: ToolChange from T10 to T1 Why? It shouls say T10 instead of T1.....

Where does T1 Come from?

Please advise!!
« Last Edit: December 15, 2016, 07:16:49 AM by Bx3mE »

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #1 on: December 15, 2016, 08:39:18 AM »
Go into your Mach4 Config and select the Tools tab, You will find a "Tool Change Type" section, change this too "T on M6 line is tool to use", Voila it should now work ;-)

DazTheGas
Theres always time for a choccy biccy

Offline Bx3mE

*
  •  68 68
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #2 on: December 15, 2016, 09:17:09 AM »
Thanks!!!

Its funny how some difficult (as experienced by the user) problems have the easiest solutions.... :D

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #3 on: December 15, 2016, 09:42:45 AM »
It got me too ;-)

DazTheGas
Theres always time for a choccy biccy

Offline Bx3mE

*
  •  68 68
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #4 on: December 15, 2016, 09:50:14 AM »
Hmmm running the M6 script fine... Now on to the next problem.

When I run Gcode, the second time I hit an M6 the M6 script executes fine but when done it does not return to where I was in the Gcode but instead it goes to the first M6 command in the file and executes it..???
WTF? Now Im lost,

Note. Im running the GCode file in singleblock mode... if that matters....

Offline Bx3mE

*
  •  68 68
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #5 on: December 15, 2016, 11:29:26 AM »
correction. when done with the M6 script the second time it seems that single block is disabled and it runs the gcode file from the beginning (thus hitting the M6 as the second line of code...)

Offline Bx3mE

*
  •  68 68
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #6 on: December 22, 2016, 05:40:37 AM »
I have been playing aroud whith my script but am still unable to pinn down what the real error is.... Any ideas?

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #7 on: December 22, 2016, 04:38:26 PM »
This could answer your question

4) Changed handling of T codes in interpreter so that
   multiple T codes on individual lines before an M6
   is issued will be handled gracefully. Some CAM programs
   seem to like to issue T codes when no tool changes are
   actually happening. Multiple T codes in one block is
   still an error.

DazTheGas
Theres always time for a choccy biccy
Re: Mach 4 Bug showing in M6 Script
« Reply #8 on: May 05, 2017, 05:27:21 AM »
I also have the problem that my M6 tool change macro always uses the tool number from the first tool change command rather than get the current requested by the G code. Unfortunately none of the solutions fit.

I can't find a mistake in the macro code.

Code: [Select]
function m6()
local inst=mc.mcGetInstance()

local CurrentTool=mc.mcToolGetCurrent(inst)
local SelectedTool=mc.mcToolGetSelected(inst)

if (SelectedTool==CurrentTool) then
mc.mcCntlSetLastError(inst, "Werkzeugwechsel nicht erforderlich. Angefordertes Werkzeug bereits eingewechselt!")
do return
end
end

wx.wxMessageBox(""..CurrentTool.."")
wx.wxMessageBox(""..SelectedTool.."")

end

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

By the way, at the moment I use Mach4 Demo, Version: 4.2.0.3233. Could it be, that it's only a problem of the demo version or has the licensed version the same problem?

Has somebody else an idea how to solve the problem?

Greetings Jannis

Offline Stuart

*
  •  264 264
    • View Profile
Re: Mach 4 Bug showing in M6 Script
« Reply #9 on: May 05, 2017, 05:36:47 AM »
Check the setting in Mach config tools it should tool on t6 line is tool in use not the default