Hello Guest it is March 28, 2024, 05:06:13 PM

Author Topic: help macro to call g54 , g55, g56, g57,g58, g59, g60  (Read 1834 times)

0 Members and 1 Guest are viewing this topic.

help macro to call g54 , g55, g56, g57,g58, g59, g60
« on: November 26, 2021, 12:07:06 AM »
Hello, how are you? I have built a machine that has 7 heads,
I would like to know if you can create a macro that when reading a tool change in g code, the macro calls the offset in the X and Y axes of that tool.
I tried but I don't understand any programming and
I've seen videos of machines doing it but I can't.
I only have this macro M6 star but it does not work well for me
Thank you
attentively

'get new tool number
   newtool = GetSelectedTool()

       'select Offset by toolnumber
       If newtool = 1 Then
           Code "G54"
       Else         
           Code "G55"
           
      End If
   
           
        If newtool = 2 Then
           Code "G55"
         Else       
           Code "G56"       
   
       End If       
       
       
        If newtool = 3 Then
           Code "G56"
       Else   
       
           Code "G57"   
     
   
       End If



« Last Edit: November 26, 2021, 12:09:08 AM by pedropin »

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: help macro to call g54 , g55, g56, g57,g58, g59, g60
« Reply #1 on: November 26, 2021, 02:43:49 AM »
maybe this is what you are looking for

Code: [Select]
'get new tool number
newtool = GetSelectedTool()

'select Offset by toolnumber
If newtool = 1 Then
Code "G54"
End If
If newtool = 2 Then
Code "G55"
End If
If newtool = 3 Then
Code "G56"
End If
If newtool = 4 Then
Code "G57"
End If
If newtool = 5 Then
Code "G58"
End If
If newtool = 6 Then
Code "G59"
End If
If newtool = 7 Then
Code "G59P7"
End If
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: help macro to call g54 , g55, g56, g57,g58, g59, g60
« Reply #2 on: November 26, 2021, 02:47:36 AM »
this version will also set new toollength if it is set in tooltable

Code: [Select]
'get new tool number
newtool = GetSelectedTool()

'select Offset by toolnumber
If newtool = 1 Then
Code "G54"
End If
If newtool = 2 Then
Code "G55"
End If
If newtool = 3 Then
Code "G56"
End If
If newtool = 4 Then
Code "G57"
End If
If newtool = 5 Then
Code "G58"
End If
If newtool = 6 Then
Code "G59"
End If
If newtool = 7 Then
Code "G59P7"
End If
 
SetCurrentTool(newtool)
Code "G43H" 6 newtool

       

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: help macro to call g54 , g55, g56, g57,g58, g59, g60
« Reply #3 on: November 26, 2021, 09:23:08 AM »
Thank you very much this is what I need, how good the help of this forum.
why in the last line of the code you write?
  Code "G59P7"

have a good day and thank you again

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: help macro to call g54 , g55, g56, g57,g58, g59, g60
« Reply #4 on: November 26, 2021, 11:17:46 AM »
if you have a look to config -> fixtures there is no G60 the next after G59 is G59P7.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: help macro to call g54 , g55, g56, g57,g58, g59, g60
« Reply #5 on: November 29, 2021, 10:34:46 AM »
ahhh I understood thank you sir

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: help macro to call g54 , g55, g56, g57,g58, g59, g60
« Reply #6 on: June 16, 2022, 04:05:14 AM »
you mean:
Code: [Select]
Code "G43H" &newtool

it is just to activate tool length compensation

the original code:
Code: [Select]
Code "G43H" 6 newtool
was faulty the 6 has to be a &
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.