Hello Guest it is March 28, 2024, 01:38:07 PM

Author Topic: MACRO, New WorkLog with tool change output  (Read 5813 times)

0 Members and 1 Guest are viewing this topic.

Offline BR549

*
  •  6,965 6,965
    • View Profile
MACRO, New WorkLog with tool change output
« on: May 09, 2010, 12:38:33 PM »
First create a new button on the main screen OR use an existing EMPTY button. I used the AutoToolZero button as it is NOT used. This button is used to START any program that you want logged. Just load your program and if you want it logged then Push the Button to start the program. It will turn ON the  LOG function and start the log. IF there is NO worklog.txt file  IT will create the file for you.

Next add in the M6start code to the M6start macro

NOW  create an M1030 macro. It will automatically be called by the M30 in the program. You must enclude an M30 and your program end for this to work.

Once you have started the program with the LOGFILE button you do not use it again until the next program start. To restart after the tool changes you do the standard cyclestart as you normally do.

IF you do not want to log the file then just use the Cycle start button. The M1030 will sense that you did not use the LogFile button and wil NOT add any info to the file.

******************************************************

'Macro ProgramRun use for start worklog code
Open"C:/Mach3/worklog.txt" For Append As #1
Write #1,"" & Date &"....." & Filename &"," &"StartTime " & Time()
Close#1
SetVar(499,0)
DoButton(0)
End

*******************************************
'M6Start Macro

  tool = GetSelectedTool()
  SetCurrentTool( tool )


Open "C:/Mach3/Worklog.txt" For Append As #1
Write #1,"__________ToolChange "  &  "T# " & GetSelectedTool() & "," & Time()
Close #1
End
 

*******************************************

'Macro M1030 use to build the M1030 macro that the M30 calls at program end

Sub main()
If GETvar(499) <> 0 Then End
If GetVar(499) =0 Then

Open "C:/mach3/worklog.txt" For Append As #1
Write #1,"          " &Filename &"..........EndingTime" & Time()
Close #1

setVar(499,1)
End If
End Sub 
 
*******************************************
WorkLog Sample Output

"5/9/2010.....C:\Mach3\GCode\TestWorkLog.txt,StartTime 12:01:42 PM"
"__________ToolChange T# 1,12:01:43 PM"
"__________ToolChange T# 2,12:01:55 PM"
"__________ToolChange T# 3,12:02:00 PM"
"__________ToolChange T# 4,12:02:05 PM"
"          C:\Mach3\GCode\TestWorkLog.txt..........EndingTime12:02:10 PM"

Hope that helps