What I would like to do is expand on what I have created below. The current format for folders/files is: …\[<drawing #><space><property>]\[<design#>]\design#.dwg - where [xx] is the folder name.
What I have not figured out is how to write jobNum, jobProperty, cadName, cDate & tabCount into the title block of each tab/sheet.
Remember I need to be able to just type shtfill [temporarily p-values] on the command line of any drawing on our server & it will update the title block to the current folder/file path.
Code:
(defun c:p-values (/ tabCount loName)
(if (= (getvar 'dwgtitled) 1)
(progn (getValues) ; continue if file has been saved
(if (= (substr jobNum 1 1) "0")
(progn (alert "jobNum not passed") ; do something for no job number
)
(progn ;continue on
(print jobNum)
(print jobProperty)
(print cadName)
(princ)
(setq cDate (menucmd (strcat "m=$(edtime, $(getvar,date),MO/DD/YY)")))
(print cDate)
(setq tabCount (length (layoutlist)))
(print tabCount)
(princ)
)
)
)
(alert "File must be saved first")
)
)
(defun getValues (/ dwgname dwgprefix path jobDir i jobLen len lenDir) ;get values from path
(progn (vl-filename-base (getvar 'dwgname))
(setq path (vl-string-right-trim "\\" (getvar 'dwgprefix))
path (substr path 1 (vl-string-position (ascii "\\") path 0 T))
jobDir (substr path
(+ 2 (vl-string-position (ascii "\\") path 0 T))
)
len (strlen jobDir)
i 1
)
(while (<= i len)
(if (= (substr jobDir i 1) " ")
(progn (setq i (1+ len)))
(progn (setq jobLen i) (setq i (1+ i)))
)
)
(setq jobNum (substr jobDir 1 jobLen)
lenDir (strlen jobDir)
jobProperty (substr jobDir (+ 2 jobLen) lenDir)
cadName (vl-filename-base (getvar 'DWGNAME))
)
)
)