(DEFUN c:SPout ()
(SETQ SIZE (GETSTRING "INPUT DUCT SIZE = "))
(SETQ DW (GETVAR "DWGNAME"))
(SETQ L (STRLEN DW))
(SETQ LT L)
(SETQ TA "1" c (+ l 1) p 0)
(WHILE (<= P L)
(SETQ AS (SUBSTR DW C 1))
(IF (/= AS "\\")
(SETQ TA (STRCAT TA AS))
(SETQ P LT))
(setq c (- c 1) p (+ p 1))
)
(setq fi (substr ta 2 (- l (+ c 1))))
(setq fj (substr ta 2 (- l c)))
(setq l1 (strlen fj))
(setq fa "1" q 0 c1 (+ l1 1))
(while (<= q l1)
(setq c1 (- c1 1) q (+ q 1))
(setq as1 (substr fj c1 1))
(setq fa (strcat fa as1))
(setq ta1 (substr fa 2 l1))
)
(setq file (strcat "File:" (getvar "dwgprefix") ta1))
(setq x (getvar "cdate"))
(setq x (rtos x 2 0))
(setq date (strcat "Date:" (substr x 5 2) "-" (substr x 7 2) "-" (substr x 3 2)))
(setq 1dsc (getvar "dimscale"))
(if (>= 1dsc 1)(progn
(setq dsc (rtos 1dsc 2 1))
(setq sca (strcat "Scale:1/" dsc ))))
(if (< 1dsc 1)
(progn
(setq t1sca (/ 1 1dsc))
(setq tsca (rtos t1sca 2 1))
(setq sca (strcat "Scale:" tsca "/1"))
))
(setq data (strcat file ".DWG, " date ",SIZE=" SIZE))
(setq ins (append (list (* 5 (getvar "dimscale"))) (list (* 2 (getvar "dimscale")))))
(command "text" ins "" "0" data)
(PRINC)
)
