(vl-load-com)
(defun c:zhf:draw_use_lt (/ ltold ltscold tmp str ltlst n m prp err_old factor nlt)
  (defun zhf:loadline (lname / adoc msp ltps lname)
    (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
    (setq ltps (vla-get-linetypes adoc))
    (setq
      ltp (vl-catch-all-apply 'vla-load (list ltps lname "zhf.lin"))
    )
;;;    (if	(vl-catch-all-error-p ltp)
;;;      (princ "此线型已存在！")
;;;    )
    (princ)
  )
  (defun newerr	(msg)
    (setq *error* err_old)
    (and ltold(setvar "CELTYPE" ltold))
    (and ltscold(setvar "ltscale" ltscold))
  )
;;;______________________________
  (or zhf:draw_use_lt:num (setq zhf:draw_use_lt:num 0))
  (setq err_old *error*
	*error* newerr)
  (setq ltlst '(("素土夯实" 4) ("自然土" 1) ("小草" 1)("斜线" 2)("鹅卵石"2)("坡道"2)("坡道2"2)))
  (setq	prp (mapcar 'car ltlst)
	m   0
  )
  (print)
  (foreach n prp
    (princ (strcat (itoa m) "-" n "  "))
    (setq m (1+ m))
  )
  (princ (strcat "<" (itoa zhf:draw_use_lt:num) ">:"))
  (setq str (getstring))
  (if (/= "" str)
    (setq str (atoi str)
	  zhf:draw_use_lt:num
	   str
    )
    (setq str zhf:draw_use_lt:num)
  )
  (setq nlt (car (nth str ltlst)))
  (setq factor (cadr (nth str ltlst)))
  (zhf:loadline nlt)
  (setq	ltold	(getvar "CELTYPE")
	ltscold	(getvar "ltscale")
  )
  (setq tmp (getvar "dimscale"))
  (if (< tmp 10)
    (setq tmp (* 100 tmp factor))
    (setq tmp (* 1 tmp factor))
  )
  (setvar "CELTYPE" nlt)
  (setvar "ltscale" tmp)
  (command "._pline")
  (while (/= 0 (getvar "cmdactive")) (command pause))
  (newerr)
)
