Hello Guest it is January 28, 2020, 09:06:04 AM

Author Topic: Add a button to Mach screen  (Read 2022 times)

0 Members and 1 Guest are viewing this topic.

Add a button to Mach screen
« on: June 27, 2009, 05:48:23 AM »
A gentleman got me going in the right direction with the code below.  Quick background:  I use a couple hundred different toolpaths generated from vcarve.  what i want to do is load one at g54, a different one at g55, and a different one at g56.  Those positions are 0,0;  0,10; and 0,20.  Then i want to hit start and walk away.  This guy gave me code to run 2, but I want to run  3 at three different offsets each time i start the machine.  So how can I create a button that says, "Load Multiple" then use this code?  I'm not a VB programmer, but I'm trying to  learn something.

~~~~

Below is my code for opening then running 2 g-code files. The Run Button code will run either 2 or 1 depending on led#1110. I hope someone can find it useful.
Bill

Load Button

If GetUserLED (1110) = 1 Then
DoOEMButton (216)
While IsLoading()
Wend
cutfile = (FileName())
SetUserLabel (2,cutfile)
DoOEMButton (216)
While IsLoading()
Wend
camerafile = (FileName())
SetUserLabel (1,camerafile)
Else
DoOEMButton (216)
While IsLoading()
Wend
cutfile = (FileName())
SetUserLabel (2,cutfile)
camerafile = "None"
SetUserLabel (1,camerafile)
End If 



Run Button

If GetUserLED (1110) = 1 Then
If GetUserLED (1112) = 0 Then
SetUserLED (1111,1)
camerafile = GetUserLabel(1)
LoadFile (camerafile)
While IsLoading()
Wend
Sleep (1000)
DoButton (0)
While IsMoving()
Sleep (2000)
Wend
Sleep (5000)
SetUserLED (1111,0)
SetUserLED (1112,1)
Sleep (100)
End If
If GetUserLED (1112) = 1 Then
cutfile = GetUserLabel(2)
LoadFile (cutfile)
While IsLoading()
Wend
Sleep (1000)
DoButton (0)
While IsMoving()
Sleep (2000)
Wend
Sleep (5000)
SetUserLED (1112,0)
Sleep (100)
End If
Else
SetUserLED (1112,1)
Sleep (1000)
DoButton (0)
While IsMoving()
Sleep (2000)
Wend
Sleep (5000)
SetUserLED (1112,0)
End If