cudaracer
Electrical
- Oct 9, 2002
- 22
My company has recently started to use the ddts.lsp routine to place the file path, date and time on drawings, they are now looking for a way to modify the lisp routine to include the users' login name also, The current routine is as follows:
;;; ***** DDTS.LSP *****
;;;
;;; Places Drawing name, Date and Time Stamp at lower left corner of drawing
;;;
(defun cDTS (/ CE AP CL DP DN CD MX HR MN LM LX DX TH DS MO YR TS TM UN TX OSM)
(setq OSM (getvar "OSMODE"))
(setvar "OSMODE" 0)
(setq CE (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq TS (getvar "TEXTSIZE"))
(setq AP "AM"
CL (getvar "CLAYER")
DP (getvar "DWGPREFIX")
DN (getvar "DWGNAME")
UN (GETENV "U")
CD (rtos (getvar "CDATE") 2 4)
MX (atoi (substr CD 5 2))
HR (atoi (substr CD 10 2))
MN (substr CD 12 2)
LM (getvar "LIMMIN")
LX (getvar "LIMMAX")
DX (distance LM LX)
TH (/ DX 552)
DS (polar LM (/ pi 5) (/ DX 60))
;;;DS (polar LM (/ pi 6) (/ DX 100)) [orig]
MO (nth MX '(nil "JAN" "FEB" "MAR" "APR" "MAY" "JUN"
"JUL" "AUG" "SEP" "OCT" "NOV" "DEC"))
)
(if (>= HR 12) (setq AP "PM"))
(if (>= HR 13) (setq HR (itoa (- HR 12))) (setq HR (itoa HR)))
(setq YR (strcat "DATE: " MO " " (substr CD 7 2) ", " (substr CD 1 4)))
(setq TM (strcat "DWG. NAME: " DP "" DN " " YR " TIME: " HR ":" MN " " AP))
(command ".LAYER" "T" "DATESTAMP" "")
(command ".LAYER" "N" "DATESTAMP" "C" "7" "DATESTAMP" "S" "DATESTAMP" "")
(setq TX (ssget "X" (list (cons 8 "DATESTAMP"))))
(command ".ERASE" TX ""
".STYLE" "STANDARD" "" "0" "1" "0" "N" "N" "N"
".TEXT" DS TH "0" TM
".LAYER" "S" CL ""
)
(setvar "CMDECHO" CE)
(setvar "TEXTSIZE" TS)
(print)
(print TM)
(setvar "OSMODE" OSM)
(command "qsave")
(princ)
)
They would like it to appear between the file name and time and I'm not certain what variable to use to pull the login name from the computer. Any help would be greatly appreciated.
Thanks,
Don
;;; ***** DDTS.LSP *****
;;;
;;; Places Drawing name, Date and Time Stamp at lower left corner of drawing
;;;
(defun cDTS (/ CE AP CL DP DN CD MX HR MN LM LX DX TH DS MO YR TS TM UN TX OSM)
(setq OSM (getvar "OSMODE"))
(setvar "OSMODE" 0)
(setq CE (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq TS (getvar "TEXTSIZE"))
(setq AP "AM"
CL (getvar "CLAYER")
DP (getvar "DWGPREFIX")
DN (getvar "DWGNAME")
UN (GETENV "U")
CD (rtos (getvar "CDATE") 2 4)
MX (atoi (substr CD 5 2))
HR (atoi (substr CD 10 2))
MN (substr CD 12 2)
LM (getvar "LIMMIN")
LX (getvar "LIMMAX")
DX (distance LM LX)
TH (/ DX 552)
DS (polar LM (/ pi 5) (/ DX 60))
;;;DS (polar LM (/ pi 6) (/ DX 100)) [orig]
MO (nth MX '(nil "JAN" "FEB" "MAR" "APR" "MAY" "JUN"
"JUL" "AUG" "SEP" "OCT" "NOV" "DEC"))
)
(if (>= HR 12) (setq AP "PM"))
(if (>= HR 13) (setq HR (itoa (- HR 12))) (setq HR (itoa HR)))
(setq YR (strcat "DATE: " MO " " (substr CD 7 2) ", " (substr CD 1 4)))
(setq TM (strcat "DWG. NAME: " DP "" DN " " YR " TIME: " HR ":" MN " " AP))
(command ".LAYER" "T" "DATESTAMP" "")
(command ".LAYER" "N" "DATESTAMP" "C" "7" "DATESTAMP" "S" "DATESTAMP" "")
(setq TX (ssget "X" (list (cons 8 "DATESTAMP"))))
(command ".ERASE" TX ""
".STYLE" "STANDARD" "" "0" "1" "0" "N" "N" "N"
".TEXT" DS TH "0" TM
".LAYER" "S" CL ""
)
(setvar "CMDECHO" CE)
(setvar "TEXTSIZE" TS)
(print)
(print TM)
(setvar "OSMODE" OSM)
(command "qsave")
(princ)
)
They would like it to appear between the file name and time and I'm not certain what variable to use to pull the login name from the computer. Any help would be greatly appreciated.
Thanks,
Don