Author Topic: (challenge) Save editing time to a log file  (Read 10273 times)

0 Members and 2 Guests are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
(challenge) Save editing time to a log file
« on: September 20, 2004, 04:42:59 PM »
To keep better track of what is being worked on for how long (mainly because I forget to fill my timesheet out until the day it needs to be turned in.)

Code: [Select]
*Open drawing sets start time
*Closing drawing ends timer
*Log file is edited to show the drawing name, date opened, time opened, time closed, total edited time per drawing, total edited time of all drawings
*Log file pertains to all drawings within the same folder, i.e. creates a different log file for drawings in a different folder.


Hope I'm not overstepping my boundries by issuing a challenge that I have no idea on how to complete...I guess this is more of a request, then.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(challenge) Save editing time to a log file
« Reply #1 on: September 20, 2004, 06:26:21 PM »
This would really be a VBA reactor type program. Probably more work than a challenge would be suitable for.
I'll look at what I have and see if I can find something.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

JohnK

  • Administrator
  • Seagull
  • Posts: 10651
(challenge) Save editing time to a log file
« Reply #2 on: September 20, 2004, 08:41:04 PM »
I think you could do that with VL.

Place code in a "comon tools.lsp" or your "Acad.lsp" file for the startup drawing part.

Create a reactor event for the command close or the doc close event and then your off and running.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

danny

  • Guest
(challenge) Save editing time to a log file
« Reply #3 on: September 20, 2004, 10:33:11 PM »
I've read an article, "Step Savers in AutoCAD 2005" by Lynn Allen, where her step saver # 10 states:
A new Express Tool called EditTime lets you track your drawing time to the second. You can turn the timer on and off and even specify a timeout period.  If there's no activity for that length of time, AutoCAD turns the timer off automatically.  Time information is stored with the drawing file, and you can access it via Visual LISP.

I have no idea how it works, but it would be a great management tool to incorporate in the earlier versions of CAD.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(challenge) Save editing time to a log file
« Reply #4 on: September 20, 2004, 11:22:33 PM »
Well now that you mention it, there is the drawing variable tdindwg
The return value is <days>.<fraction of days>

just do the math and it should give you the total editing time in a drawing.

There is also a diesel setting you can use:
Code: [Select]

$(edtime , $(getvar, tdindwg), dd:hh:mm:ss)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

SMadsen

  • Guest
Re: (challenge) Save editing time to a log file
« Reply #5 on: September 21, 2004, 05:25:30 AM »
Quote from: Dommy2Hotty
I guess this is more of a request, then.
Right.

The biggest problem with loggers like that - as well as the time records saved by the drawing - is non-billable time. What do you do when you go to lunch and leave the drawing open? Or get involved in projects that are billable elsewhere while having the drawing open? Or having a drawing open for design center purposes (copy/paste) without actually working on the drawing?

Sometimes I've been called out in haste to meetings that dragged out so long that getting back to the office wasn't an option. Leaving drawings open overnight seriously adds to billable time.

I've found that the human computer is the best time tracker there is. Just 2 euro cents.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
(challenge) Save editing time to a log file
« Reply #6 on: September 21, 2004, 09:59:59 AM »
Here is the previous thread on that subject.
http://theswamp.org/phpBB2/viewtopic.php?t=2238&highlight=timesheet

The software  use stops crediting time to a project is the keyboard and/or mouse is inactive for 3 min.
This timer is adjustable. If you take a call or do some work away from the computer
there is an icon to start a stop watch for that task.
If you are billing by the hour or keeping track of employees, this software will do it.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

sinc

  • Guest
(challenge) Save editing time to a log file
« Reply #7 on: February 16, 2005, 01:37:03 PM »
Quote from: Dommy2Hotty
To keep better track of what is being worked on for how long (mainly because I forget to fill my timesheet out until the day it needs to be turned in.)

I keep running into a similar problem.  But I don't really care too much about having a timer, I just need to remember what all I've been working on.

So I added the following to my acaddoc.lsp:

Code: [Select]
(defun timedate (/ cdate ctime ampm stime)
  (setq cdate (rtos (fix (getvar 'cdate)) 2 0)
ctime (rtos (rem (getvar 'cdate) 1) 2 6)
ampm  (if (<= (atof (substr ctime 3 2)) 12)
"AM"
"PM"
     )
stime (strcat
(substr cdate 1 4)
"-"
(substr cdate 5 2)
"-"
(substr cdate 7 2)
" "
(substr ctime 3 2)
":"
(substr ctime 5 2)
":"
(substr ctime 7 2)
":"
ampm
     )
  )
)
(defun-q MYSTARTUP ()
(if (not (wcmatch (getvar 'DWGNAME) "Drawing1.dwg"))
  (progn
  (setq FILEDESC (open "C:/AutocadFiles.log" "a"))
  (write-line
    (strcat (timedate)
    " "
    (getvar 'DWGNAME)
    " "
    (getvar 'DWGPREFIX)
    )
    FILEDESC
  )
  (close FILEDESC)
  (setq FILEDESC nil)
  )
)
)
(setq S::STARTUP (append S::STARTUP MYSTARTUP))

Just a simple thing that writes the time, date, name, and path of each drawing as it's opened.  As you can see, as listed here the log file is "C:AutocadFiles.log".  The check for "Drawing1.dwg" keeps it from logging "Drawing1" every time ACAD first starts up (I really wish Autodesk would fix that, and not create a "Drawing1" before running the startup dialog).

Is there a time limit on responses to challenges?  :)

ImaJayhawk

  • Guest
(challenge) Save editing time to a log file
« Reply #8 on: February 16, 2005, 05:55:17 PM »
I use Autocad Today to find out what drawings I've been working on....
Only use I've found for it. :?


-ImaJayhawk

sinc

  • Guest
(challenge) Save editing time to a log file
« Reply #9 on: February 16, 2005, 07:02:04 PM »
I completely forgot that thing existed.  I turned it off a long time ago, because it was annoying.  I just did a brief look, and couldn't even figure out how to get to it again.  I found one mention of it in the help, but nothing on how to get to it.  Since I don't really need or want it, I guess it's going to stay lost...  :lol:

ImaJayhawk

  • Guest
(challenge) Save editing time to a log file
« Reply #10 on: February 17, 2005, 10:31:39 AM »
I've got it turned off as well.  I just type today in the command line when I want to see what I've been working on.  
 :)

-ImaJayhawk

Big G

  • Bull Frog
  • Posts: 415
(challenge) Save editing time to a log file
« Reply #11 on: February 17, 2005, 10:52:40 AM »
Quote from: ImaJayhawk
I use Autocad Today to find out what drawings I've been working on....
Only use I've found for it. :?


-ImaJayhawk


heh that IS the only use for it!!
I thought i seen the light at the end of the tunnel. But it was just someone with a torch bringing me more work.
"You have to accept that somedays youre the pigeon and  somedays youre the statue"

nivuahc

  • Guest
(challenge) Save editing time to a log file
« Reply #12 on: February 17, 2005, 11:15:07 AM »
I feel silly even posting this but this is what I use in my MENU_NAME.mnl file to help us fill out our timesheets:

Code: [Select]
(defun cadlog (/ user_name job_no dwg_no open_time log_file)
  (setq user_name    (getvar "loginname")
job_no       (getvar "dwgprefix")
dwg_no       (getvar "dwgname")
open_time    (getvar "cdate")
log_file     (open (strcat "z:\\" user_name "_cadlog.txt") "a"))
(write-line (strcat (thedate open_time "-") " at " (thetime open_time nil) " " job_no dwg_no) log_file)
(close log_file)
)

   
I have the following two functions, thedate and thetime that I use a lot

Code: [Select]
(defun thedate (date1 sep1 /)
;;return the date as a string formatted like 03-06-2000
;;date1 = the date as returned by (getvar "cdate")
;;sep1  = the separator to be used (- of /)
(setq date1 (rtos date1 2 8))
(strcat (substr date1 5 2)
sep1
(substr date1 7 2)
sep1
(substr date1 1 4)
)
) ;_ end defun thedate


and

Code: [Select]
(defun thetime (date1 dec1 /)
;;return the time as a string formatted like 14:23:55 or 14:23:55.35
;;date1 = the date as returned by (getvar "cdate")
;;dec1  = if t, include decimals of a second, else hh:mm:ss.
(setq date1 (rtos date1 2 8))
(if dec1
(strcat (substr date1 10 2)
":"
(substr date1 12 2)
":"
(substr date1 14 2)
"."
(substr date1 16 2)
)
(strcat (substr date1 10 2)
":"
(substr date1 12 2)
":"
(substr date1 14 2)
)
) ;_ end if
) ;_ end defun thetime


What I end up with is something that looks like this, stored in a text file on each users Z drive called username_cadlog.txt

Code: [Select]
02-08-2005 at 08:09:57 P:\04068 ASU Student Center\dwgs\E204.dwg
02-08-2005 at 08:11:56 P:\04068 ASU Student Center\dwgs\E301A.dwg
02-08-2005 at 08:22:19 P:\04068 ASU Student Center\dwgs\E301B.dwg
02-08-2005 at 08:34:30 P:\04068 ASU Student Center\dwgs\E302A.dwg
02-08-2005 at 08:35:51 P:\04068 ASU Student Center\dwgs\E303A.dwg
...


The only drawback is that it doesn't tell you how long you actually worked on each drawing but, I don't really care about that. What I was concerned about was, 2 weeks after the fact, my memory (as well as everyone elses) needed a little jogging regarding what projects you were working on.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: (challenge) Save editing time to a log file
« Reply #13 on: October 11, 2005, 04:04:40 PM »
Quote from: Dommy2Hotty
To keep better track of what is being worked on for how long (mainly because I forget to fill my timesheet out until the day it needs to be turned in.)
I keep running into a similar problem.  But I don't really care too much about having a timer, I just need to remember what all I've been working on.

So I added the following to my acaddoc.lsp:

Code: [Select]
(defun timedate (/ cdate ctime ampm stime)
  (setq cdate (rtos (fix (getvar 'cdate)) 2 0)
ctime (rtos (rem (getvar 'cdate) 1) 2 6)
ampm  (if (<= (atof (substr ctime 3 2)) 12)
"AM"
"PM"
     )
stime (strcat
(substr cdate 1 4)
"-"
(substr cdate 5 2)
"-"
(substr cdate 7 2)
" "
(substr ctime 3 2)
":"
(substr ctime 5 2)
":"
(substr ctime 7 2)
":"
ampm
     )
  )
)
(defun-q MYSTARTUP ()
(if (not (wcmatch (getvar 'DWGNAME) "Drawing1.dwg"))
  (progn
  (setq FILEDESC (open "C:/AutocadFiles.log" "a"))
  (write-line
    (strcat (timedate)
    " "
    (getvar 'DWGNAME)
    " "
    (getvar 'DWGPREFIX)
    )
    FILEDESC
  )
  (close FILEDESC)
  (setq FILEDESC nil)
  )
)
)
(setq S::STARTUP (append S::STARTUP MYSTARTUP))
Just a simple thing that writes the time, date, name, and path of each drawing as it's opened.  As you can see, as listed here the log file is "C:AutocadFiles.log".  The check for "Drawing1.dwg" keeps it from logging "Drawing1" every time ACAD first starts up (I really wish Autodesk would fix that, and not create a "Drawing1" before running the startup dialog).

Is there a time limit on responses to challenges?  :)

This has worked for me with no problems.  I had a co-worker add this to her acad2004doc.lsp file and it gives her this error:
Code: [Select]
AutoCAD Express Tools Copyright © 2002-2003 Autodesk, Inc.
; error: Invalid attempt to access a compiled function definition.  You may
want to define it using defun-q: #<SUBR @05d2f9d8 S::STARTUP>

I added it to hers the same way I added it to mine:
Command: (startapp "notepad" (findfile "acad2004doc.lsp"))
But her's throws the error.  Any ideas?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: (challenge) Save editing time to a log file
« Reply #14 on: October 11, 2005, 04:14:44 PM »
On 'her' machine there must be a (defun S::STARTUP ( ) ... ) being executed before your (setq S::STARTUP (append S::STARTUP yada) stament. Check if she has an acad.lsp / acad.mnl etc. defining S::STARTUP before you get at it.

You could always add this --

Code: [Select]
(cond
    ;;  assuming the MYSTARTUP function is defined properly ...
    (   (null S::STARTUP) 
        (setq S::STARTUP MYSTARTUP)
    )
    (   (listp S::STARTUP)
        (setq S::STARTUP (append S::STARTUP MYSTARTUP))
    )
    (   (alert
            (strcat
                "Error:\n\n"
                "S::STARTUP function defined by defun, not defun-q."
            )   
        )
    )   
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst