Hello Guest it is January 27, 2022, 04:25:56 PM

Author Topic: Macro, Worklog  (Read 4007 times)

0 Members and 1 Guest are viewing this topic.

vmax549

*
Macro, Worklog
« on: March 28, 2009, 11:33:28 PM »
Here is a set of macros to have mach create a WORKLOG of each Program ran during the day. The results are stored in a file and can the file can be opened in NOTEPAD and printed out if needed.

To use you would need BOTH macros. The M1029 macro is called from a button Script to start the process AND the M1030 runs at eh completion of the program when the M30 is called to end the program.

You can either Install a new BUTTON called Prog Run Log (used to start the Program rather than the cycle start) 

OR you can use an EMPTY button on the screen to call the M1029 macro ( I use the Auto Tool Zero Button on the main screen(;-))

The reason for the diferent program run button is so that you can use the normal Cycle start button to do all the setup and testing and what nots AND it will not clog up the Worklog with a lot of useless data. Then when you need to run the Program and log the Program you just use the ProgRunLog button then it will log the run.(;-)

Mach will append the data to the end of the file each time you run it . IF you want to save off the file and start fresh each month just coy the file over to another directory and then delete the file from the mach directory. Next time you run it it will create a new file automatically.

How it works is you load the Gcode Program and get ready to run. When you are ready Press the ProgRunLog button and it sets up a temp file and write the base info to it THEN calls the CYCLE START to start the program.

At eh M300 at the end of the program it calls the m1030 macro which take s the base info and addes the current ifo to it and write it to a permanant file that is stored in teh mach directory. It can be opened with notebook for review.

Report example:
""C:\Mach3\GCode\Shapes.tap,  3/28/2009,  StartTime  11:41:44 PM",  EndTime 11:42:44 PM , Total Run Time 1  Minutes"
""C:\Mach3\GCode\roadrunner.tap,  3/28/2009,  StartTime  11:42:48 PM",  EndTime 11:48:51 PM , Total Run Time 6  Minutes"





CODE EXAMPLE:

'Macro , M1029 Button Script for WORKLOG
Open "c:/Mach3/TempLOG.txt" For Output  As #1
Write #1, Filename &",  " &Date &",  " &"StartTime  " &Time()
Close #2
SETVAR(100,0)
STtime = Time
STh= Hour(STtime)
STm= Minute(STtime)
STT= ((STh *60) + STM)
Setvar(550, STT)
DOButton(0)
End


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

'Macro M1030  Prints the Work Log at the End Of Program(M30)
Sub main()
SPtime =Time
SPh= Hour(SPtime)
SPm= Minute(SPtime)
SPTc= ((SPh *60) + SPm)
STTC= GetVAR(550)
TRT= (SPTc - STTc)

If GETparam(100) = 0 Then
Open "c:/Mach3/TempLOG.txt" For Input  As #2
Do While Not EOF(2)
Line Input #2, filedata
ST= filedata
Loop
Close #2
ET=Time()

Open "C:/mach3/worklog.txt" For Append As #3
Write #3,"" &st &",  EndTime " &ET &" , Total Run Time " & TRT &"  Minutes"
Close #3
setparam(100,1)
End If
End Sub
 End

« Last Edit: March 28, 2009, 11:53:48 PM by vmax549 »