I mean something like this:
Code:
(defun test (/ adoc *error* pt1 pt2 pt3 text)
(defun *error* (msg)
(vla-endundomark adoc)
(princ msg)
(princ)
) ;_ end of defun
(vl-load-com)
(vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
(if (and (= (type (setq pt1 (vl-catch-all-apply
(function
(lambda ()
(getpoint "\nStart point <Cancel> : ")
) ;_ end of lambda
) ;_ end of function
) ;_ end of vl-catch-all-apply
) ;_ end of setq
) ;_ end of type
'list
) ;_ end of =
(= (type
(setq pt2 (vl-catch-all-apply (function (lambda () (getpoint pt1 "\nSecond point <Cancel> : ")))))
) ;_ end of type
'list
) ;_ end of =
(= (type (setq pt3 (vl-catch-all-apply
(function (lambda (/ gr)
(grdraw pt1 pt2 -1)
(getpoint pt2 "\nFinish point <Cancel> : ")
) ;_ end of lambda
) ;_ end of function
) ;_ end of vl-catch-all-apply
) ;_ end of setq
) ;_ end of type
'list
) ;_ end of =
(= (type (setq text (vl-catch-all-apply
(function
(lambda (/ res str is_next)
(while (and (setq str (getstring t
(strcat "\n"
(if is_next
"Next"
"First"
) ;_ end of if
" string <"
(if is_next
"Cancel"
"Enough"
) ;_ end of if
"> : "
) ;_ end of strcat
) ;_ end of getstring
) ;_ end of setq
(/= str "")
) ;_ end of and
(setq res (cons str res)
is_next t
) ;_ end of setq
) ;_ end of while
(reverse res)
) ;_ end of lambda
) ;_ end of function
) ;_ end of vl-catch-all-apply
) ;_ end of setq
) ;_ end of type
'list
) ;_ end of =
text
) ;_ end of and
(progn
(setq pt_lst (apply (function append) (list pt1 pt2 pt3)))
(vla-addleader
(vla-get-modelspace adoc)
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbdouble
(cons 0 8)
) ;_ end of vlax-make-safearray
pt_lst
) ;_ end of vlax-safearray-fill
) ;_ end of vlax-make-variant
(vla-addmtext
(vla-get-modelspace adoc)
(vlax-3d-point pt3)
0.
(strcat (car text)
(apply 'strcat
(mapcar (function (lambda (x) (strcat "\\P" x))) (cdr text))
) ;_ end of apply
) ;_ end of strcat
) ;_ end of vla-addmtext
aclinewitharrow
) ;_ end of vla-addleader
) ;_ end of progn
) ;_ end of if
(vla-endundomark adoc)
(princ)
)