Author Topic: (REQUEST)TimeStamp  (Read 5438 times)

0 Members and 1 Guest are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
(REQUEST)TimeStamp
« on: March 22, 2004, 04:14:48 PM »
Does anyone have a timestamp progy they use --or even used to use-- for acad.  I dont want answers like "use R-text" or anything, if you dont have one that's alright, ill just have to write one tonight. (I wanted to give a quick demo)  

Just checking...

Later,
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(REQUEST)TimeStamp
« Reply #1 on: March 22, 2004, 04:24:52 PM »
Uh .. use R-Text ....

ok, so you don't want that answer ...

What functionality do you want.. timestamp at open? at close? when the user specifies and picks a button?

What format?

hh:mm:ss.ms ?

mm/dd/yy hh:mm:ss.ms ?

I have something.. but not quite sure what you want...
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: 10605
(REQUEST)TimeStamp
« Reply #2 on: March 22, 2004, 04:35:05 PM »
Just a real simple timestamp progy that will update a text entry (or block) upon save or plot. (Would like it to be an "auotmatic" app but a manual program will do. ...Im not picky at all.)

thanx
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(REQUEST)TimeStamp
« Reply #3 on: March 22, 2004, 04:46:18 PM »
Ok, let me look at my archives and I will see what I can find ....
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

CADaver

  • Guest
(REQUEST)TimeStamp
« Reply #4 on: March 22, 2004, 04:47:06 PM »
Quote from: Se7en
Just a real simple timestamp progy that will update a text entry (or block) upon save or plot. (Would like it to be an "auotmatic" app but a manual program will do. ...Im not picky at all.)

thanx


try HERE

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
(REQUEST)TimeStamp
« Reply #5 on: March 22, 2004, 05:23:02 PM »
here's some code that might help.
Code: [Select]

(defun theyear ()
  (substr (itoa (fix (getvar 'cdate))) 1 4)
  )
  ;; example (setq y (theyear))

(defun themonth ()
  (substr (itoa (fix (getvar 'cdate))) 5 2)
  )
  ;; example (setq m (themonth))

(defun theday ()
  (substr (itoa (fix (getvar 'cdate))) 7)
  )
  ;; example (setq d (theday))

(defun thetime (/ ctime ampm stime)
  (setq ctime (rtos (rem (getvar 'cdate) 1) 2 6)
        ampm (if (<= (atof (substr ctime 3 2)) 12) "AM" "PM")
        stime (strcat
                (substr ctime 3 2)":"
                (substr ctime 5 2)":"
                (substr ctime 7 2)":"ampm
                )
        )

  )
  ;; example (setq curtime (thetime))
  ;; "10:18:58:AM"
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
(REQUEST)TimeStamp
« Reply #6 on: March 22, 2004, 05:29:21 PM »
Thanx alot guys.

Ill tell ya all what happned when i get home.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
(REQUEST)TimeStamp
« Reply #7 on: March 22, 2004, 06:51:34 PM »
Had this one.
Don't know where i got it though. :D

Code: [Select]
;;; FUNCTION
;;; time stamp, searches dwg for text/dtext that contains "Time Stamp:"
;;; if found, it updates the text to the current date and time. format
;;; looks like 'Time Stamp: 03/31/2003@13:22'.
;;;
;;; ARGUMENTS
;;; none
;;;
;;; USAGE
;;; add it to you acad.lsp to run every time you open the dwg, or a plot
;;; reactor to update it when plotting, or a button to update when you
;;; feel like it, or simply type in (mst-tstamp) to see it work
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2003 Mark S. Thomas
;;; mark.thomas@bigswamp.org
;;;
;;; VERSION
;;; 1.0    Mon Mar 31, 2003
(defun MST-TStamp (/ *doc* *mspace* *pspace* mst-date switch)
  (vl-load-com)
  (setq
    *doc* (vla-get-ActiveDocument (vlax-get-acad-object))
    *mspace* (vla-get-ModelSpace *doc*)
    *pspace* (vla-get-PaperSpace *doc*)
    ); setq

  (defun MST-date (/ tmp)
    (setq tmp (rtos (getvar 'cdate) 2 4))
    (strcat "Time Stamp: "
            (substr tmp 5 2) "/"
            (substr tmp 7 2) "/"
            (substr tmp 1 4) "@"
            (substr tmp 10 2) ":"
            (substr tmp 12 2)
            )

    ); defun

  ; search modelspace first
  (vlax-for item *mspace*
            (if
              (= (vlax-get-property item 'ObjectName) "AcDbText")
              (if
                (wcmatch
                  (vlax-get-property item 'TextString)
                  "*Time Stamp:*"
                  )
                (progn
                  (vlax-put-property item 'TextString (mst-date))
                  (setq switch 1)
                  (if
                    (not (vlax-object-released-p item))
                    (vlax-release-object item)
                    )
                  )
                ) ; if
              ) ; if
            )

  ; search paperspace if not found in modelspace
  (if
    (not switch)
    (vlax-for item *pspace*
              (if
                (= (vlax-get-property item 'ObjectName) "AcDbText")
                (if
                  (wcmatch
                    (vlax-get-property item 'TextString)
                    "*Time Stamp:*"
                    )
                  (progn
                    (vlax-put-property item 'TextString (mst-date))
                    (setq switch 2)
                    (if
                      (not (vlax-object-released-p item))
                      (vlax-release-object item)
                      ); if
                    )
                  ); if
                )
              )
    ); if

  ; release the overhead, just for the heck of!
  (mapcar 'vlax-release-object (list *doc* *mspace* *pspace*))

  (if (= switch nil) (princ "\nTime Stamp Not Found In DWG..."))

  (princ)
  ); defun
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.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
(REQUEST)TimeStamp
« Reply #8 on: March 22, 2004, 07:36:07 PM »
...perfect!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
(REQUEST)TimeStamp
« Reply #9 on: March 22, 2004, 08:48:29 PM »
now why couldn't I find that........
TheSwamp.org  (serving the CAD community since 2003)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(REQUEST)TimeStamp
« Reply #10 on: March 23, 2004, 12:20:26 AM »
You didn't look where it was ????
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

CADaver

  • Guest
(REQUEST)TimeStamp
« Reply #11 on: March 23, 2004, 07:51:51 AM »
(setq pldate (menucmd "m=$(edtime, $(getvar, date),dd-mon-yy hh:mmam/pm)"))