TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: JohnK 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,
-
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...
-
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
-
Ok, let me look at my archives and I will see what I can find ....
-
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 (http://tinyurl.com/2gzus)
-
here's some code that might help.
(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"
-
Thanx alot guys.
Ill tell ya all what happned when i get home.
-
Had this one.
Don't know where i got it though. :D
;;; 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
-
...perfect!
-
now why couldn't I find that........
-
You didn't look where it was ????
-
(setq pldate (menucmd "m=$(edtime, $(getvar, date),dd-mon-yy hh:mmam/pm)"))