Hello Guest it is April 19, 2024, 08:13:56 PM

Author Topic: What is the proper way to make a button perform this code?  (Read 1738 times)

0 Members and 1 Guest are viewing this topic.

Offline mike^3

*
  •  116 116
    • View Profile
What is the proper way to make a button perform this code?
« on: July 01, 2015, 04:00:31 PM »

Hello

I am trying to creat 8 buttons on my screen so that I can click on one and it will goto the commanded tool.

 I have this code that works great in m6 macro for my tool changer, yet when I copy and past (only the top one for tool 1) into the button script, it wont work, gives me errors. Any help? I just want button 1, to goto tool one and use the first if statement in it.

 If GetSelectedTool() = GetCurrentTool() Then
 End
 End If
 
 If GetSelectedTool = 1 Then
  Code "G53 G0 A0"
 Code "G53 G0 A-5"
 Code"G92 A0"   
 While IsMoving()
 Wend
 End If
 
 If GetSelectedTool = 2 Then
  Code "G53 G0 A45"
 Code "G53 G0 A40"
 Code"G92 A45"
 While IsMoving()
 Wend
 End If
 
 If GetSelectedTool = 3 Then
  Code "G53 G0 A90"
 Code "G53 G0 A85"
 Code"G92 A90"
 While IsMoving()
 Wend
  End If
 
 If GetSelectedTool = 4 Then
  Code "G53 G0 A135"
 Code "G53 G0 A130"
 Code"G92 A135"
 While IsMoving()
 Wend
  End If
 
 If GetSelectedTool = 5 Then
  Code "G53 G0 A180"
 Code "G53 G0 A175"
 Code"G92 A180"
 While IsMoving()
 Wend
  End If
 
 If GetSelectedTool = 6 Then
  Code "G53 G0 A225"
 Code "G53 G0 A220"
 Code"G92 A225"
 While IsMoving()
 Wend
  End If 
 
 If GetSelectedTool = 7 Then
  Code "G53 G0 A270"
 Code "G53 G0 A265"
 Code"G92 A270"
 While IsMoving()
 Wend
  End If
 
 If GetSelectedTool = 8 Then
  Code "G53 G0 A315"
 Code "G53 G0 A310"
 Code"G92 A315"
 While IsMoving()
 Wend
  End If   

END

Offline mike^3

*
  •  116 116
    • View Profile
Re: What is the proper way to make a button perform this code?
« Reply #1 on: July 01, 2015, 04:02:13 PM »
Actually i just got it to work by copying

 If GetSelectedTool = 1 Then
  Code "G53 G0 A0"
 Code "G53 G0 A-5"
 Code"G92 A0"   
 While IsMoving()
 Wend
 End If