Author Topic: Real edit time.  (Read 4997 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
Real edit time.
« on: June 05, 2005, 08:30:14 AM »
Morning Everybody,

I know there is a nice arx in A2006 Express Tools, Edittime.arx ,to set a timeout time and in the end of the day you can get the real edit time you spent on your dwg’s.

But my company is still working with A2002, and will do so till next year, so I need to do something myself.

It is not a big deal to write some code with the  :vlr-commandEnded and vlr-commandWillStart  and a timeout time set first to cover that demand.

But I always worry when it comes to reactors that fire all the time when me or my collages do our work, I don’t want to slow down the system.

So I wonder if a command reactor is noticeable slowing down acad .

Thanks in advance for your expertise

Bernd

DEVITG

  • Bull Frog
  • Posts: 480
edited time
« Reply #1 on: June 06, 2005, 01:02:53 AM »
This are not mine , and I do not whom is the author.
maybe it what you need

Code: [Select]
;;*Calculates the Current Date

  (defun TODAY (/ d yr mo day)
    (setq d   (rtos (getvar "CDATE") 2 6)
 yr  (substr d 3 2)
 mo  (substr d 5 2)
 day (substr d 7 2)
    )  ;setq
    (strcat day "/" mo "/" yr)
  )  ;defun





  ;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

(defun TIME (/  hr m s)
    (setq ##t  (rtos (getvar "CDATE") 2 6)
 hr (substr ##t 10 2)
 m  (substr ##t 12 2)
 s  (substr ##t 14 2)
    )  ;setq
    (setq hhmmss (strcat hr ":" m ":" s))
  )  ;defun



  ;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
  (defun ETIME (/ hr1 m1 s1 tot1 hr2 m2 s2 tot2 total ht mt file fp)
    (setq hr1 (* 60 (* 60 (atof (substr time1 1 2))))
 m1 (* 60 (atof (substr time1 4 2)))
 s1 (atof (substr time1 7 2))
 tot1 (+ hr1 m1 s1)
 hr2 (* 3600 (atof (substr time2 1 2)))
 m2 (* 60 (atof (substr time2 4 2)))
 s2 (atof (substr time2 7 2))
 tot2 (+ hr2 m2 s2)
 total (- tot2 tot1)
 hr1 (/ total 3600)
 ht (fix hr1)
 hr1 (- hr1 ht)
 mt (* hr1 60)
 ht (rtos ht)
 mt (rtos mt)
    )  ;setq
    (setq d (strcat "Editing Time This Session :
  "    ht     " Hours and "
   mt     " minutes"
  )
    )
    (setq file (findfile "LOG.TXT"))
 fp   (open file "a")
    )  ;setq
    (princ d fp)
    (princ "\n" fp)
    (princ
      "==========================
===================================="
      fp
    )
    (princ "\n" fp)
    (close fp)
    (princ)
  )  ;defun




Neither I know if it works or not .
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Real edit time.
« Reply #2 on: June 06, 2005, 02:38:24 AM »
I can tell you just by looking at the first line of the main ETIME routine that it WILL NOT work ..
.... and wonder why you waste bandwidth posting it. ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Amsterdammed

  • Guest
Real edit time.
« Reply #3 on: June 06, 2005, 07:24:39 AM »
Gentlemen,
The Edit timer is not the question,  I’m testing the code I wrote right now. The Question is if Command Reactors that check a timeout at every command might slow down acad in a not acceptable way.

Bernd

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Real edit time.
« Reply #4 on: June 06, 2005, 09:03:38 AM »
That's a good question; I would have to assume that it would. (Of course I dont have any benchmarks or anything. --actually I don’t think I would know of a good way to even test that.)

But, for the sake of argument... Lets say that the processor speed and your network is fairly fast enough to cut the lag. Your still gonna have AutoCAD chewing up more process' then normal. That would leave less resources for email, word processing, & etc. Is it worth it? Or would just a simple excel spreadsheet or a VBA app that asks you to enter time when you open a drawing and when you close it a better solution?

And that being said; How hard would it be to create a VB app that marks the time every time the computer goes on screen saver mode. (Of course this wouldnt get you TRUE results but could the times be considered good enough? --and that each person was working on only one proj at one time.)

Oh so much to consider. So much unknown.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Amsterdammed

  • Guest
Real edit time.
« Reply #5 on: June 06, 2005, 09:42:34 AM »
:( Thanks Se7en for your no nonsense point of view.

You are right, in perfect world it would be enough to open an excel file and so on.

The reality unfortunately is that I’m working for one of the biggest Mechanical and Electrical Installation Companies in the Netherlands, and we work a lot there with people we rent from human resource companies, so we don’t know them that well and they don’t know the procedures in our company that well.

Combine this with the fact that some of our drawings are big (not in bits and bites only, but also in hours to design), and the most important fact that we are losing money right now in our designing procedures, we need to do a better controlling and early alert.

The early alert means, if; let’s say a drawing is scheduled to take 200 hours, as a supervisor you might want to know when, let’s say 50% of those are already spent, to check what the progress might be.

So that is why I want to let things happen as far as possible in the Background and to keep us Cad people busy with Cad, not administration work.

Bernd

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Real edit time.
« Reply #6 on: June 06, 2005, 09:58:17 AM »
Okay, can we go about this in a diff manner?

Here's what im thinking. Let's say that we attach a persistant reactor to the drawing. (And it prolly dosent even have to be that complicated) Lets say that we add a lisp to log the time and date when a person opens a dwg. and when the drawing is closed it does the same. So if a drafter/designer is "in" a drawing they are assumed to be "working". Now you could set SDI mode to eliminate having a dwg open for hours in the background.

Oh?! *Idea!* How bad do you think the numbers would be if you use something like the "TDINDWG" var to get the drawing edit time? To vague?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Amsterdammed

  • Guest
Real edit time.
« Reply #7 on: June 06, 2005, 10:15:22 AM »
I do it more complicated,

In my mnl file I set a startmime when opening a dwg,  I set
Quote

(SETQ tek-start-TIME (GETVAR "DATE")
      edittime 0
      last-endtime tek-start-TIME
      last-starttime tek-start-TIME
      timeout 15
      )

Than I have two reactors, also start up with the mnl file.
Quote

(DEFUN gti_edit-timer-start(REFOBJ CMDLIST)
;;;

  (if (<= (setq lastpeditperiod(* 24 60(- (getvar "date" )(max last-starttime last-endtime))))timeout)
  ; als de tijd tussen het laaste commando (als uitgevoerd, de endtijd, als afgebroken de starttijd.)
    ;kleiner is dan de timeout wordt de tijd als werktijd goedgeschreven.

(setq edittime (+ edittime lastpeditperiod)))
(setq last-starttime (getvar "date"))
 
  )

(DEFUN timer-s()
  (VL-LOAD-COM)
  (VLR-COMMAND-REACTOR
    NIL
    '((:VLR-COMMANDWILLSTART . gti_edit-timer-start))))
(timer-s)


(DEFUN gti_edit-timer-end(REFOBJ CMDLIST)

(setq last-endtime (getvar "date"))
)
(DEFUN timer-e()
  (VL-LOAD-COM)
  (VLR-COMMAND-REACTOR
    NIL
    '((:vlr-commandEnded . gti_edit-timer-end))))


And in the end I check
Quote

(defun write-to-log()
(if (and (< 15 edittime) (= 1 (getvar "DWGTITLED")))
    (progn
;edittime overzetten in  0.25 uur delen

     

      (setq uren (/ edittime 60))
(setq minutes (* 100(- uren (fix uren)))
      uren (fix uren))
(cond ((<= minutes 12)
            (setq minutes      0))
                   
((and(>= minutes 13) (<= minutes 37))
         (setq minutes         0.25))

 ((and(>= minutes 38) (<= minutes 62))
      (setq minutes            0.50))
((and(>= minutes 63) (<= minutes 87))
       (setq minutes           0.75))
((>= minutes 88)
 (setq minutes  0
       uren (1+ uren))))

      (setq edittime (+ uren minutes))

I round  on 15 minutes

And write it to a log file.

So what I worry is only if the reactors will harm the normal work.

Bernd

 

 

 

[/quote]

JohnK

  • Administrator
  • Seagull
  • Posts: 10637
Real edit time.
« Reply #8 on: June 06, 2005, 10:22:07 AM »
Okay, So you want to test the time. How about we start from the begining: How about if you build a way to test the time it take to complete a command with and without your utility loaded?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Amsterdammed

  • Guest
Real edit time.
« Reply #9 on: June 06, 2005, 10:34:57 AM »
Yes, I guess you are right,
I just thought somebody might have expirence with those reactors, I don’t.

So I will write a lisp that repeat let’s say a 1000 times a command and stops the time and do it with reactors and without.

Bernd

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Real edit time.
« Reply #10 on: June 06, 2005, 01:44:06 PM »
Hi Bernd

If you collect the information by global vars, you've no notable delay in commands:
Code: [Select]
;
; == AcadDoc.lsp ==============================================================
; Sets Command Reactors to collect the command time.
; Sets a DocManager Reactor to release the Reactor objects at the end
; of an AutoCAD session.
; Copyright:
;   ©2005 MENZI ENGINEERING GmbH, Switzerland
; Notes:
;   - None
; - Initialize ActiveX support
(vl-load-com)
;
; - Initialize session variables
;
(setq Me:DwgNme "" ;empty drawing name
      Me:CmdTim 0 ;command time
      Me:CmdTmp 0 ;temporary command time
      Me:CmdCnt 0 ;command count
      Me:TimOut 180 ;command timeout
)
;
; - Reactors ------------------------------------------------------------------
;
; - If not set, initialize DocManager-Reactor
(or Me:ReaDma
 (setq Me:ReaDma (VLR-DocManager-Reactor
                  nil
                 '(
                   (:VLR-documentToBeDestroyed . MeDocToBeDestroyedCallbacks)
                  )
                 )
 )
)
; - If not set, initialize DWG-Reactor
(or Me:ReaDwg
 (setq Me:ReaDwg (VLR-DWG-Reactor
                  nil
                 '(
                   (:VLR-SaveComplete . MeDwgSaveCompleteCallbacks)
                  )
                 )
 )
)
; - If not set, initialize Command-Reactor
(or Me:ReaCom
 (setq Me:ReaCom (VLR-Command-Reactor
                  nil
                 '(
                   (:VLR-commandWillStart . MeCommandWillStartCallbacks)
                   (:VLR-commandEnded . MeCommandEndedCallbacks)
                   (:VLR-commandCancelled . MeCommandCancelledCallbacks)
                  )
                 )
 )
)
;
; - Notifications -------------------------------------------------------------
;
; - MeDwgSaveComplete notifications
(defun MeDwgSaveCompleteCallbacks (Rea Arg)
 (MeDoDwgSaveCompleteStuff Arg)
 (princ)
)
; - CommandWillStart notifications
(defun MeCommandWillStartCallbacks (Rea Arg)
 (MeDoCmdWillStartStuff Arg)
 (princ)
)
; - CommandEnded notifications
(defun MeCommandEndedCallbacks (Rea Arg)
 (MeDoCmdEndedStuff Arg)
 (princ)
)
; - CommandCancelled notifications
(defun MeCommandCancelledCallbacks (Rea Arg)
 (MeDoCmdCancelledStuff Arg)
 (princ)
)
; - DocToBeDestroyed notifications
(defun MeDocToBeDestroyedCallbacks (Rea Arg)
 (MeWriteToLog)
 (MeDoCloseStuff)
 (princ)
)
;
; - Subs ----------------------------------------------------------------------
;
; - DWG save complete function
(defun MeDoDwgSaveCompleteStuff (Arg)
 (setq Me:DwgNme (cadr Arg))
 (princ)
)
; - Command will start function
(defun MeDoCmdWillStartStuff (Arg)
 (setq Me:CmdTmp (getvar "MILLISECS")
       Me:CmdCnt (1+ Me:CmdCnt)
 )
 (princ)
)
; - Command ended function
(defun MeDoCmdEndedStuff (Arg / TmpVal)
 (setq TmpVal (- (getvar "MILLISECS") Me:CmdTmp)
       Me:CmdTim (if (> TmpVal (* Me:TimOut 1000)) ;User is sleeping
                  Me:CmdTim
                  (+ TmpVal Me:CmdTim)
                 )
 )
 (princ)
)
; - Command cancelled function
(defun MeDoCmdCancelledStuff (Arg / TmpVal)
 (setq TmpVal (- (getvar "MILLISECS") Me:CmdTmp)
       Me:CmdTim (if (> TmpVal (* Me:TimOut 1000)) ;User was sleeping
                  Me:CmdTim
                  (+ TmpVal Me:CmdTim)
                 )
 )
 (princ)
)
;
; - Write to log function
(defun MeWriteToLog ()
 (alert (strcat
         "Drawing name:\t\t" Me:DwgNme
         "\nTotal command time:\t" (MeCalcTime Me:CmdTim)
         "\nTotal commands called:\t" (itoa Me:CmdCnt)
        )
 )
 (princ)
)
; - Reactor cleanup function
(defun MeDoCloseStuff ( / VarLst)
 (setq VarLst (MeGetReaVars))
 (mapcar 'VLR-remove (mapcar 'eval VarLst))
 (mapcar '(lambda (l) (set l nil)) VarLst)
 (princ)
)
; - Collect global reactor variables
(defun MeGetReaVars ( / RetVal)
 (foreach memb (atoms-family 1)
  (if (wcmatch (strcase memb) "ME:REA*")
   (setq RetVal (cons memb RetVal))
  )
 )
 (mapcar 'read RetVal)
)
; - Calculate time from msecs
(defun MeCalcTime (Val / TimHrs TimMin TimSec TmpVal)
 (setq TmpVal (fix (/ Val 1000.0))
       TimSec (rem TmpVal 60)
       TmpVal (/ (- TmpVal TimSec) 60)
       TimMin (rem TmpVal 60)
       TimHrs (/ (- TmpVal TimMin) 60)
 )
 (strcat (itoa TimHrs) "h " (itoa TimMin) "m " (itoa TimSec) "s")    
)

(princ)
; == End AcadDoc.lsp ==========================================================
Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

Amsterdammed

  • Guest
Real edit time.
« Reply #11 on: June 06, 2005, 02:05:14 PM »
I ran that code
Quote

(setq start (getvar "date"))

(repeat 10000

(command "move" (entlast) "" '(0 0) '(0 2))

  )
  (setq time (* 24 60 60 (- (getvar "date") START)))

once without  the reactors loaded (7.703 sec)
 and once with reactors (9.92197 sec)
 
3 sec for 10000 commands are a slowdown I take.

Thanks all.

Bernd
[/quote]

DEVITG

  • Bull Frog
  • Posts: 480
please apologize me
« Reply #12 on: June 08, 2005, 10:40:20 PM »
Quote from: Kerry Brown
I can tell you just by looking at the first line of the main ETIME routine that it WILL NOT work ..
.... and wonder why you waste bandwidth posting it. ?



I say it was not mine , even I do not know whom is the author .
Maybe you can fix it, and give us your invaluable time to  have the correct way.

Thank in advance
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Real edit time.
« Reply #13 on: June 08, 2005, 11:39:20 PM »
DEVITG

Amsterdammed and Jürg have a working solution posted. I don't think I could do a more correct routine than either of those guys ..

.. sorry if you got upset.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.