Hello Guest it is April 19, 2024, 03:02:10 AM

Author Topic: Mach3 Macro issue  (Read 792 times)

0 Members and 1 Guest are viewing this topic.

Mach3 Macro issue
« 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

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Mach3 Macro issue
« Reply #1 on: January 02, 2021, 04:16:07 PM »
I would make the M50 macro part of this program, make it a sub.
Without engineers the world stops

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Mach3 Macro issue
« Reply #2 on: January 03, 2021, 05:30:35 AM »
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.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.