The previous routine only works with MTEXT objects. This routine, however, works with both MTEXT and DTEXT objects and even makes the process easier.
Here’s how:
- MTLE <enter> to start
- Select the Text object(s)
- Specify where the end point (arrow) of the leader should go.
(defun c:mlte (/) (c:MLeaderToExistingtext)) (defun c:MLeaderToExistingtext (/) (vl-load-com) (cond ;;Select the text/mtext objects ((or (null (setq ss1 (ssget ":S" '((0 . "text,mtext"))))) (= 0 (setq ssl (sslength ss1))) ) nil ;nothing selected ) (T (setq Textobj (vlax-ename->vla-object (ssname ss1 0)) ActSpace (if (= 0 (getvar "cvport")) (vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)) ) (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)) ) ) StartPt (getpoint "\nPick location for point of arrow head: ") txt (vla-get-TextString Textobj) TextPt (vla-get-insertionpoint textobj) TextPt (vlax-variant-value TextPt) TextPt (vlax-safearray->list TextPt) ptlist (vlax-make-safearray vlax-vbdouble '(0 . 5) ) ptlist (vlax-safearray-fill ptlist (append StartPt TextPt)) MLObj (vla-addmleader ActSpace ptlist 'LeaderIndex ) ) (vla-put-textstring mlobj txt) (vla-delete Textobj) ) ) )
Hi Greg
I keep getting the following error message!
; error: no function definition: VLAX-ENAME->VLA-OBJECT
Kev
Thanks for the heads-up.
I have updated the code
The code was missing (vl-load-com)
This loads the ability for Visual Lisp functions.
Keep in mind that this is a common issue with code that you may find online. It doesn’t hurt to add this to any routine where you see a warning that mentions VLA-object…
Thanks
MTLE to start
Select the Text object(s) ???
Finally works with MLTE , command not MTLE !!!!
Can’t use with other ucs.
Try the one found here: http://www.theswamp.org/index.php?topic=30934.0;all
Pingback: Text to Multileader | AutoCAD Tips
How to do this with multiple text objects, keeping justification, rotation and position? Please help
On the link provided, scroll down to “TLEADER V2.0” and give that a try


http://www.ductisoft.com/FreeLisp/freelispwebsiteEN.html
WHERE CAN I DOWNLOAD THIS LISP ?