'New spoil board Skim   'Created by Krishna KC for W and R Jacks.'Jan 2013' Declare Global VariablesDim XfixDim YfixDim Zfix'Define fixed parameters (Currently in Metric )Skim = 0.3 'depth of skim passthinboard = 3 'thinnest spoil board allowed 'Skimfile = "D:\NC files\Skims\test.txt"Skimfile = "C:\Mach3\GCode\skim\skim.txt"' Begin the ProgramIf GetOemLed(807) = True Then 'Check X axis has been refernced 	MsgBox("X axis not reference - Please referance all axis and try again.")	EndEnd IfIf GetOemLed(808) = True Then 'Check Y axis has been refernced 	MsgBox("Y axis not reference - Please referance all axis and try again.")	EndEnd IfIf GetOemLed(809) = True Then 'Check Z axis has been refernced 	MsgBox("Z axis not reference - Please referance all axis and try again.")	EndEnd IfNewboard = 0While Newboard < thinboard	Newboard = Question ("Enter the thickness of the new spoil board")	If Newboard < thinboard Then 		MachMsg( "Spoil board too thin, please replace with a board thicker than " & thinboard & "mm try again", "Spoil board too thin", 0)		End	End IfWendCode "G59 P253" ' Get fixture offset #255 and set new work surface thickness of new boardXfix = GetOemDro (830)Sleep (100)Yfix = GetOemDro (831)Sleep (100)SetOemDro(832,Newboard)Sleep (100)Code "G54" ' Set fixture offset #1 and set new work surface thickness of new boardSetOemDro (830,Xfix)Sleep (10)SetOemDro (831,Yfix)Sleep (10)SetOemDro(832,Newboard)Sleep (10)LoadFile(Skimfile)Sleep (100)While IsLoading()	Sleep (25)Wend  If (GetOEMLED (67)) = Fulse Then 'Turn controll offline for sim	DoOEMButton(178)End IfDoOEMButton (1015) 'run simTme = 0 While (GetOEMLED (18)) = True 	Sleep(100)	Tme = Tme +.1	If(Tme > 300)Then		MsgBox("Simulation timed out - please check!")		End	End IfWendIf (GetOEMLED (67)) = True Then 'Turn controll back online 	DoOEMButton(178)End IfSleep(100)Answer = MachMsg("Is the skim tool loaded into tool station 6 and the correct tool offset applied?","Skim tool check", 1)If Answer = 1 Then	Answer = MachMsg( "Are you ready To run the skim program?","Are you ready to skim?", 1)	If Answer = 1 Then		RunFile() 		End	End IfEnd IfEnd     