A linetype can be read from a .lin file no need for code.
*HOT_WATER_SUPPLY,Hot water supply ---- HW ---- HW ---- HW ----
A,12.7,-5.08,["HW",STANDARD,S=2.54,R=0.0,X=-2.54,Y=-1.27],-5.08
We had custom.lin with lots of linetypes and would preload into our dwt so ready to go. Or Linetype Load 1 or more linetype into a dwg.
;load missing linetypes
;;; returns: T if loaded else nil
(loadLinetype doc "Fence" "custom.lin")
(loadLinetype doc "Tree" "custom.lin")
(setq doc (vla-get-activedocument (vlax-get-acad-object))) ; open database
(defun loadLinetype (doc LineTypeName FileName)
(if (and
(not (existLinetype doc LineTypeName))
(vl-catch-all-error-p
(vl-catch-all-apply
'vla-load
(list
(vla-get-Linetypes doc)
LineTypeName
FileName
)
)
)
)
nil
T
)
)
(defun existLinetype (doc LineTypeName / item loaded)
(vlax-for item (vla-get-linetypes doc)
(if (= (strcase (vla-get-name item)) (strcase LineTypeName))
(setq loaded T)
)
)
)