Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: Royke777 on January 02, 2021, 03:24:53 PM
-
Hello.
I have make a M6 code for the toolchanger and an M50 for the toolprobe, these M-code work well in a G-code program.
Now I have made a script to measure all the tools in the machine and then he will do all kinds of strange things.
Does anyone know what I'm doing wrong?
thank you in advance
Script:
'Tool1
If GetUserLED(1050) Then
Call SetUserLED (1070,0)
Code "T1 M6"
While ismoving()
Sleep(500)
Wend
Code "M50"
While ismoving()
Sleep(500)
Wend
End If
'Tool2
If GetUserLED(1051) Then
Code "T2 M6"
While ismoving()
Sleep(500)
Wend
Code "M50"
While ismoving()
Sleep(500)
Wend
End If
'Tool3
If GetUserLED(1052) Then
Code "T3 M6"
While ismoving()
Sleep(500)
Wend
Code "M50"
While ismoving()
Sleep(500)
Wend
End If
-
I would make the M50 macro part of this program, make it a sub.
-
to call a macro within a macro is a nogo in Mach3, but you can put your code into a g-Code file witch should work.
your userled's 1050 and upward look like a tool present Switch, witch can be also controlled in M6 and M50,
or like Graham decided use Sub's in your script.
you can also have a look at:
https://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf
for the #Expand functionality, then you can Keep your sub's in a common file.