Creating LineTypes has never been pretty.
(defun SetLType (n d f / lf rf nl)
;;;LineType_Name Descriptor File_name
(cond ((not (findfile (strcat f ".LIN")))
(setq lf (open (strcat f ".LIN") "w"))
(write-line ";; Specialty LineTypes" lf)
(write-line "" lf)
(close lf)
(command "_.LINETYPE" "_Create" n f
"----- ----- ----- ----- ----- -----" d ""
"_.LINETYPE" "_Load" n f ""))
((not (tblsearch "LTYPE" n))
(setq rf (open (strcat f ".LIN") "r"))
(while (setq nl (read-line rf))
(if (wcmatch nl (strcat "`*" n ",*"))
(setq ex T)))
(close rf)
(if (not ex)
(command "_.LINETYPE" "_Create" n f
"----- ----- ----- ----- ----- -----" d ""))
(command "_.LINETYPE" "_Load" n f "")))
n)
Usage:
(SetLType "Dash" "1.25,-.25,.25,-.25,.25,-.25" "TEMP1")
-David