Hello Guest it is May 25, 2019, 03:55:07 PM

Author Topic: file logging, job timming, costing  (Read 4029 times)

0 Members and 1 Guest are viewing this topic.

file logging, job timming, costing
« on: June 26, 2008, 08:13:04 AM »
Hello all
I would like to know if it is possible to make mach3 log what files have been run, when, and for how long they have run. I know there is a Maintenance log but it only shows total machine time.
I would like this for job costing. Would any body else like this feature?
Also is there any outher software that would log PC activity, the ones I have found seem to keep screen shots, this would be wasteful of PC time and space.
Hint any software developers, a simple log activity of EXE,s could be a good product.
Thankyou Peter R

Offline poppabear

*
  • *
  •  2,231 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: file logging, job timming, costing
« Reply #1 on: June 26, 2008, 04:38:31 PM »
Ok, here is a solution,  It doesnt take into account of changing from the last day of one month, and the start of another.
Also, the same for Year Changes, it only takes into account Consecutive days in the same month.
Also The "CostEstimate.txt" File, will create itself in the Mach3 main directory.
If you want it to create some where else, you will need to change the path to where you want it to drop.
NOTE: The intermediate file "Time File" will create and destroy itself with the complete running of the G-Code part file.
What this does is create a file, called: "CostEstimate.txt"  This text shows Start Time and Date, End Time and Date, and total elapsed time on that part for: Days, Hours, Minutes, Seconds
This is TRUE elapsed time while on that part, so if you pause your G-Code for 1 hour then come back and hit cycle start, then it will add that hour to the program.

Things you will have to do for Setup:
1). You will have to change your computers System time to 24 hour clock for the time calculation to work.
2). You will need to put the Macro "M1002" at least one line down from the start of your code, and before your part starts. (the line above it can be a comment), or Init G codes.
3). You will need to put the Macro "M1003" right before your last line, which should be a M30.

Other Things:
1). You will need to run the file completly from start to finish, since these to Macros are linked to create and destroy it intermediates.
2). Once you run a part, you will have to Copy and MOVE that file, out of that area, and Print it off, If you run that same part, or some other part, the next run will delete that file, and recreate it at the end, with the new times from start to finish.

Here is the Start Timer, Date, Macro: M1002.m1s

'****************************
'M1002.m1s  Store Start time point

Open "CostEstimate.txt" For Output As #2
Close #2

Kill "CostEstimate.txt"

Dim StartTime As String               
Dim StartDate As String               

StartTime = Time(Now)
StartDate = Date()

Open "TimeFile" For Output As #1   ' Open to write file.
Write #1, StartTime
Write #1, StartDate
Close #1

Code "G4 P0.5"
While IsMoving
Wend

Sec = Second(StartTime)
Min = Minute(StartTime)
Hr = Hour(StartTime)
Dy = Day(StartDate)

SetVar(100,Sec)
SetVar(101,Min)
SetVar(102,Hr)
SetVar(103,Dy)
'***************************** 

Here is the End Timer, Date, Macro: M1003.m1s

 '*****************************
'M1003.m1s  Get End Time point and calc, and post file

Dim StartTime As String
Dim StartDate As String
Dim EndTime As String
Dim EndDate As String
Dim File As String
Dim Days

EndTime = Time(Now)
EndDate = Date()
SecEnd = Second(EndTime)
MinEnd = Minute(EndTime)
HrEnd = Hour(EndTime)
DyEnd = Day(EndDate)

SecStart = GetVar(100)
MinStart = GetVar(101)
HrStart = GetVar(102)
DyStart = GetVar(103)

File = FileName()

Open "TimeFile" For Input As #1   ' Open file.   
   Line Input #1, TextLine      ' Read line into variable.
   StartTime = TextLine      ' get start time.
   Line Input #1, TextLine      ' Read line into variable.
   StartDate = TextLine      ' get start date.   
Close #1                  ' Close file.

Code "G4 P0.5"
While IsMoving
Wend

If HrEnd<HrStart Then
Hr=((24-HrStart)+(24-(24-HrEnd)))
Else
Hr=(HrEnd-HrStart)
End If

If MinEnd<MinStart Then
Min=((60-MinStart)+(60-(60-MinEnd)))
Else
Min=(MinEnd-MinStart)
End If

If SecEnd<SecStart Then
Sec=((60-SecStart)+(60-(60-SecEnd)))
Else
Sec=(SecEnd-SecStart)
End If

If (DyEnd-DyStart)= 0 Then
Days = 0
End If

If ((DyEnd-DyStart)=1) And (HrEnd<HrStart) Then
Days = 0
End If

If ((DyEnd-DyStart)=1) And (HrEnd>HrStart) Then
Days = 1
End If

If ((DyEnd-DyStart)>1) Then
Days = (DyEnd-DyStart)
End If

Kill "TimeFile"

Open "CostEstimate.txt" For Output As #2   ' Open to write file.
Write #2, "File Name: " & File
Write #2, "Start Time: " & StartTime, "Start Date: " & StartDate
Write #2, "End Time: " & EndTime, "End Date: " & EndDate
Write #2, "Total Time: " & " Days: " & Days & " Hours: " & Hr & " Mins: " & Min & " Secs: " & Sec
Close #2

Code "G4 P0.5"
While IsMoving
Wend
'*******************************************

'Hope this helps you
'Scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline budman68

*
  • *
  •  2,360 2,360
    • View Profile
Re: file logging, job timming, costing
« Reply #2 on: June 26, 2008, 05:17:21 PM »
you never cease to amaze, Scott-  :)
----------------------------------------------------------------------
Just because I'm a Global Moderator, don't assume that I know anything !

Dave->    ;)

Offline poppabear

*
  • *
  •  2,231 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: file logging, job timming, costing
« Reply #3 on: June 26, 2008, 09:29:00 PM »
 ;D
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline KTM

*
  •  92 92
    • View Profile
Re: file logging, job timming, costing
« Reply #4 on: July 20, 2008, 05:31:27 AM »
Hi Scott

Will it be possible to automatically name the file with the time and date, thereby creating individual files for each job?
eg: CostEstimate0207081126.txt.  Where do I write the path name? eg: c:\mach3\Time logging.

Regards
KTM

Offline poppabear

*
  • *
  •  2,231 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: file logging, job timming, costing
« Reply #5 on: July 20, 2008, 10:25:55 PM »
KYM  (btw, is that KTM like the motorcycle?),

  Yes, you can do what you want, BUT, it is probably alot more trouble than it is worth.......... 

Look at the Macro, and where you see the cost estimate file, just put the path that you want that file to live in. Currently, as it is, it lives in the Mach3 main directory. You will have to change the path in BOTH macros.

Look also at how I brought in the Date/Time Macros, if you want you can rearrange their sequence and add those variables, as a String addition to the base file name. The catch will be how to transfer...........that can be done, but a major pain in the butt.

So instead, at the Ending macro, I would at that time, append the Date/Time as Sting additions on the file name.

Note: It would be wize to create a file, for all these things to live in, since once your last macro runs, and that file appears in your new file, then on the next run, this will disable the "Kill File" funcion will not work, since it has no way to "synch up" with the end macro.  Thus, if all your Files in a single seperate file, you will end up with a list of sequential time/date files, with a new one appearing every single time, you run that part file.

scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline KTM

*
  •  92 92
    • View Profile
Re: file logging, job timming, costing
« Reply #6 on: July 21, 2008, 11:58:36 AM »
Thanks Scott

Yes, KTMĀ  like the motorcycle.
Thanks for the info. I will try it on the weekend - I am still learning the VB script syntax - so it will take me some time ;)