Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 01:42:41 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
Here is a TRUE part Elapsed time, date file creator macros
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: Here is a TRUE part Elapsed time, date file creator macros (Read 5814 times)
0 Members and 1 Guest are viewing this topic.
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Here is a TRUE part Elapsed time, date file creator macros
«
on:
June 26, 2008, 03:40:30 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
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Chaoticone
South Carolina, US
Administrator
Offline
Posts: 3,598
Precision Chaos
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #1 on:
June 26, 2008, 05:13:50 PM »
Thanks for shareing that with us Scott.
Brett
Logged
If you could see the things I have in my head, you would be laughing too.
www.precisionchaos1.com
My guard dog is not what you need to worry about!
vmax549
Guest
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #2 on:
July 01, 2008, 09:09:49 AM »
GOOD Job Scott, I have a project for YA. We could use a utility to see a LCAM project file AND print out a summary of the file. THings such as NAME,TOOL list, date, time to cut,etc,etc
(;-)TP
Logged
vmax549
Guest
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #3 on:
July 01, 2008, 10:22:26 AM »
Sorry Scott, I am just on here to help the HOBBY macherteers where I can. BUT then again I don't have to make a living at it.
Good Luck,
(;-) TP
Logged
penmaker1
Active Member
Offline
Posts: 28
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #4 on:
March 08, 2009, 07:42:44 AM »
Hi Scott,
This works very well, I made a couple of minor changes to get what I need. It now keeps appending to the CostEstimate file and I changed the output format to be more useable with Excel or some other spread sheet. Now I just need to add the M1002 and M1003 macro calls to my TurboCADCAM configuration so that they are automatically added to each part file.
Thank you for making the macros available.
John Guenther
'Ye Olde Pen Maker'
Sterling, Virginia
Logged
penmaker1
Active Member
Offline
Posts: 28
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #5 on:
March 12, 2009, 03:00:56 PM »
I took the macro's posted by Scott and modified them slightly to produce a running job log. The output file is compatible with Microsoft Excel. I did this becuase I need to be able to track total time for a job with multiple parts in varying quantities for each part.
It still works Scott originally posted it with the exception that the resulting output from the M1003 macro is not destroyed with each run.
'****************************
'M1002.m1s Store Start time point
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 M1003 macro:
'*****************************
'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)))
ElseIf (HrEnd>HrStart and MinEnd>MinStart) Then
Hr=(HrEnd-HrStart)
Else
Hr = 0
End If
If MinEnd<MinStart Then
Min=((60-MinStart)+(60-(60-MinEnd)))
ElseIf (MinEnd>MinStart And SecEnd>SecStart) Then
Min=(MinEnd-MinStart)-1
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.csv" For Append As #2 ' Open to write file.
Write #2, File & " " & "," & StartDate & "," & StartTime & "," & EndDate & "," & EndTime & ","& Days & "," & Hr & ":" & Min & ":" & Sec
Close #2
Code "G4 P0.5"
While IsMoving
Wend
'*****************************
The only thing I am not pleased with is the CostEstimate.csv file has some double quotation marks in it that can be a problem for Excel to deal with. I would also like to be able to get rid of the AM and PM designations on the two time fields but have not been able to determine if VBscript will allow me to do that. Some or all of these problems are either due to the Cypress Enable scripting package or to my lack of knowledge in this area.
Any help or comments will be welcomed.
John Guenther
'Ye Olde Pen Maker'
Sterling, Virginia
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #6 on:
March 12, 2009, 05:36:56 PM »
You will need to set your System Clock to 24 hour mode instead of 12 hour mode to eliminate the AM/PM thing.
ON the "" thing, I dont know why your getting them in the CVS file, since you are not setting them in your write file.
You can try to reformat your write like this:
Write #2, File
Write #2, StartDate
Write #2, StartTime
Write #2, EndDate
Write #2, EndTime
Write #2, Days
Write #2, Hr & ":" & Min & ":" & Sec
scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
rweatherly
Active Member
Offline
Posts: 10
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #7 on:
March 15, 2009, 08:46:25 AM »
If you want to keep AM and PM on you computer clock, you can eliminate them in the write file by:
a = InStr(StartTime, " ") 'finds the first space in StartTime, which will be just before the AM or PM
StartTime = Mid$(StartTime, 1, a - 1) 'truncates the StartTime string to just before the space
Richard
Logged
penmaker1
Active Member
Offline
Posts: 28
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #8 on:
March 15, 2009, 10:38:02 AM »
Thanks Richard,
I found a timediff function posted somewhere in the internet that I have incorporated in the M1003 macro, I am now getting what I need from the macro and I have the format coming out like I want it to.
I will be posting the revised macro later today. I ran 72 parts o the lathe Friday and yesterday with the macros running and got the output I needed. I will be running some more on the lathe and mill today, once I am satisfied with the output I will update my original post with the corrected versions of the macros. I still have not figured out how to stop it from enclosing the entire output line in quotes but I can live with that.
Thanks to everyone who replied and made suggestions, they were appreciated.
John Guenther
'Ye Olde Pen Maker'
Sterling, Virginia
Logged
rweatherly
Active Member
Offline
Posts: 10
Re: Here is a TRUE part Elapsed time, date file creator macros
«
Reply #9 on:
March 15, 2009, 11:16:59 AM »
If I change the Write #1 to Print #1, it eliminates the first and last quotes.
There are still quotes on the start date and time for some reason.
Richard
Logged
Pages:
1
2
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...