DOES ANYONE KNOW OF LISP PROGRAM THAT CHANGES TEXT INTO (MONTH/DAY/YEAR)?
Command: (setq month (substr (rtos (getvar "cdate") 2) 5 2)) "09" Command: (setq day (substr (rtos (getvar "cdate") 2) 1 4)) "2004" Commandsetq year (substr (rtos (getvar "cdate") 2) 7 2)) "10" (setq today (strcat month "/" day "/" year)) Bill
Hi brownnoodle If you wish to convert the system variable 'DATE' into an readable form, use this function: Code: ; ; -- Function ConvJulianDate ; Convert julian date/time (also serial) to standard format. ; Arguments [Typ]: ; Val = Julian date/time [REAL] ; Mde = Conversion mode, eg. "MO/DD/YYYY H:MMam/pm" [STR] *) ; Return [Typ]: ; > Formatted date/time [STR] ; Notes: ; *) Details for conversion mode see Diesel, edtime ; (defun ConvJulianDate (Val Mde / TmpVal) (setq TmpVal (if (minusp (- Val 2415019.0)) (+ Val 2415019.0) Val)) (menucmd (strcat "M=$(edtime," (rtos TmpVal) "," Mde ")")) ) Use it like: (ConvJulianDate (getvar "DATE") "MO/DD/YYYY") "09/10/2004" Cheers
If you want to select an existing piece of text and have its contents changed to the current date, you can do this on a toolbar/screen/tablet menu item: [Up-Date]^C^C^P (setq datetext (entsel "Select Date Text: ")) \(setq dateassoc (entget (car datetext))) + (setq datestr (substr (rtos (getvar "CDATE") 2) 3 6)) (setq datetx (strcat (substr datestr 3 2) "/" (substr datestr 5) "/" (substr datestr 1 2))) + (setq dateassoc (subst (cons 1 datetx) (assoc 1 dateassoc) dateassoc)) (entmod dateassoc) ^P That only uses the last two digits of the year. If you want all four, do it this way: [Up-Date]^C^C^P (setq datetext (entsel "Select Date Text: ")) \(setq dateassoc (entget (car datetext))) + (setq datestr (substr (rtos (getvar "CDATE") 2) 1 8)) (setq datetx (strcat (substr datestr 5 2) "/" (substr datestr 7) "/" (substr datestr 1 4))) + (setq dateassoc (subst (cons 1 datetx) (assoc 1 dateassoc) dateassoc)) (entmod dateassoc) ^P Kent Cooper, AIA ...
Oh, and put the longer lines back together that the newsgroup system has split apart (up to the plus signs).... Kent Cooper, AIA
I save it as a lisp file. Load the lisp but it doesn't work. I'm using 2002 if that makes a difference. I'm looking for a faster way to change the dates on my drawing.
This will give you something to play with: (defun ARCH:C_DATE-ISSUE (j / y d m) (setq j (fix j) j (- j 1721119.0) y (fix (/ (1- (* 4 j)) 146097.0)) j (- (* j 4.0) 1.0 (* 146097.0 y)) d (fix (/ j 4.0)) j (fix (/ (+ (* 4.0 d) 3.0) 1461.0)) d (- (+ (* 4.0 d) 3.0) (* 1461.0 j)) d (fix (/ (+ d 4.0) 4.0)) m (fix (/ (- (* 5.0 d) 3) 153.0)) d (- (* 5.0 d) 3.0 (* 153.0 m)) d (fix (/ (+ d 5.0) 5.0)) y (+ (* 100.0 y) j) ) (if (< m 10.0) (setq m (+ m 3)) (setq m (- m 9) y (1+ y) ) ) (strcat (if (< D 10) "0" "" ) (itoa (fix D)) " " (nth (1- (fix m)) (list "Jan" "Feb" "March" "April" "May" "June" "July" "Aug" "Sept" "Oct" "Nov" "Dec" ) ) " " (substr (itoa (fix Y)) 3 2) ) ) (ARCH:C_DATE-ISSUE (getvar "TDUCREATE")) Gary
Ahh... (defun mdy (/ day month year) (setq month (substr (rtos (getvar "cdate") 2) 5 2) day (substr (rtos (getvar "cdate") 2) 1 4) year (substr (rtos (getvar "cdate") 2) 7 2) today (strcat month "/" day "/" year) ) ) ;end defun Bill