21
VB and the development of wizards / Re: Percent Complete
« on: December 03, 2007, 08:39:25 AM »
Excellent...that did it. In case it does not show...this is my first day tweaking Mach. I am a seasoned programmer, but I am having difficulty tracking down some of Mach's finer details.
I am not sure what you mean with the "load GCode" button. I was trying to redo the Load button so it loads the file then calculates the length. It tried a DoOEMButton(216), but it would hang on a part generation dialog box.
Anyway...I decided to try to take it one step further. I programmed a quick PIC chip to output a byte received on the serial port to a pair of seven segment LEDs.
I got Mach to output on the serial port the percent remaining. I changed the value to an integer and tested it for change to prevent it from sending it too often.
I assumed an unused SetVar number to hold the value. I could not find details on what numbers to use.
I found some cheap huge LEDs at www.futurlec.com. I will use them if everything proves reliable and useful.
I am not sure what you mean with the "load GCode" button. I was trying to redo the Load button so it loads the file then calculates the length. It tried a DoOEMButton(216), but it would hang on a part generation dialog box.
Anyway...I decided to try to take it one step further. I programmed a quick PIC chip to output a byte received on the serial port to a pair of seven segment LEDs.
I got Mach to output on the serial port the percent remaining. I changed the value to an integer and tested it for change to prevent it from sending it too often.
I assumed an unused SetVar number to hold the value. I could not find details on what numbers to use.
I found some cheap huge LEDs at www.futurlec.com. I will use them if everything proves reliable and useful.
Code: [Select]
filesize = GetOEMDRO(1200)
filecurrent = GetOEMDRO(816)
'=== Get percent ===
If filesize <> 0 Then
completed = CInt((filecurrent / filesize) * 100)
Else
completed = 0
End If
If GetVar(2002) <> completed Then
Call setuserDro(1201,completed )
SendSerial(Chr(completed))
Call SetVar(2002, completed)
End If