Hi Chilidawg,
See if this is what you are after.
Click "off" the leader for input.
Must esc to exit.
Number variable set as global, so it will pick up where you left off.
;|SEQUENTIALLY NUMBER AN MLEADER
P. DuMONT 06/19/2017 |;
(defun c:MLI ( / *error* cmde ldr doc ent ent_obj new_num )
(defun *error* (msg)
(if (and msg
(not (wcmatch (strcase msg t) "*break*,*cancel*,*exit*"))
) ;_ end of and
(princ (strcat "\nError: " msg))
)
(if cmde
(setvar 'cmdecho cmde)
)
(if ldr
(setvar 'cmleaderstyle ldr)
)
(if doc
(vla-endundomark doc)
)
(princ)
) ;_ end of defun
(setvar 'cmdecho 0)
(setq ldr (getvar 'cmleaderstyle))
(if
(and (setq dic (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE"))
(setq dat (dictsearch (setq dic (cdr (assoc -1 dic))) "NOTES")) ;check your Leader style here
) ;_ end of and
(setvar 'cmleaderstyle "NOTES") ;set your Leader style here
) ;_ end of if
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark doc)
(inputnum)
(while
(initcommandversion)
(command "MLEADER")
(while (= 1 (logand 1 (getvar 'cmdactive)))
(command pause)
) ;_ end of while
(setq ent (entlast)
ent_obj (vlax-ename->vla-object ent)
new_num (itoa *!num!*)
*!num!* (1+ *!num!*))
(vla-put-TextString ent_obj new_num)
) ;_ end of while
(vla-endundomark doc)
(setvar 'cmleaderstyle ldr)
(setvar 'cmdecho cmde)
) ;_ end of defun
(defun inputnum ()
(setq *!num!*
(cond
((getint
(strcat "\nStarting number? <"
(itoa (setq *!num!* (cond (*!num!*)
(1)
) ;_ end of cond
) ;_ end of setq
) ;_ end of itoa
">: "
) ;_ end of strcat
) ;_ end of getint
)
(*!num!*)
) ;_ end of cond
) ; setq
) ;_ end of defun