Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: pedropin 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
-
maybe this is what you are looking for
'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
-
this version will also set new toollength if it is set in tooltable
'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
-
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
-
if you have a look to config -> fixtures there is no G60 the next after G59 is G59P7.
-
ahhh I understood thank you sir
-
you mean:
Code "G43H" &newtool
it is just to activate tool length compensation
the original code:
Code "G43H" 6 newtool
was faulty the 6 has to be a &