Text to Multileader

This routine will allow you to select either an MTEXT or DTEXT (single line text) object and then create a multileader from its contents on the current layer and the current multileader style.

  • Here’s how:
  • AM <enter> to start Add Multileader
  • Select text object (MTEXT or DTEXT)
  • Place the multileader as you normally would…




Links to other multileader routines:




;;; By RonJon
;;; Found at http://www.cadtutor.net/forum/showthread.php?41822-changing-text-mtext-to-multileaders...
(defun c:am (/ newleader pt1 pt2 ss txt x w rjp-getbbwdth)
  (defun rjp-getbbwdth (obj / out ll ur)
    (vla-getboundingbox obj 'll 'ur)
    (setq out (mapcar 'vlax-safearray->list (list ll ur)))
    (distance (car out) (list (caadr out) (cadar out)))
  (if (setq ss (ssget '((0 . "*TEXT"))))
    (progn (setq txt (apply
			   (mapcar '(lambda (x)
				      (cons (vlax-get x 'insertionpoint)
					    (strcat (vlax-get x 'textstring) " ")
				     ss	(mapcar
					  (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
			   (function (lambda (y1 y2) (< (cadr (car y2)) (cadr (car y1))))
		 w   (car (vl-sort (mapcar 'rjp-getbbwdth ss) '>))
		 txt (apply 'strcat
			    (mapcar 'chr (reverse (cdr (reverse (vl-string->list txt)))))
	   (mapcar 'vla-delete ss)
  (if (and (setq pt1 (getpoint "\nSpecify leader arrowhead location: "))
	   (setq pt2 (getpoint pt1 "\nSpecify landing location: "))
    (progn (command "._MLEADER" pt1 pt2 "")
	   (setq newleader (vlax-ename->vla-object (entlast)))
	   (vla-put-textstring newleader txt)
	   (vla-put-textwidth newleader w)

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, AutoLISP: Modify, AutoLISP: Text, Leaders, Modifying. Bookmark the permalink.

13 Responses to Text to Multileader

  1. Brian says:

    It certainly works, but in my case, the text goes microscopic and the text positioning is strange (the leader “underlines” the text). Also, if the mtext wraps into a multi line paragraph, it will make it one continuous line.

  2. Randell says:

    My Mleader has the landing underlining all my first line of text if I lead to the right but not to the left??

    • AutoCAD Tips says:

      This is an annoying default setting in AutoCAD.
      To fix this, you need to adjust the Multileader style
      Use the command MLEADERSTYLE and then in the dialog box that appears, select the mleader style to be changed, and then select “Modify”

      Click on the “Content” tab in the dialog box and then in the lower left area there is a “Leader connection” area.
      “Horizontal attachment” should be checked. Then make sure that both “Left attachment” and “Right attachment” have the same setting applied to them. In your case i think that they should both be set to “Middle of top line”

      • Randell says:

        Thanks! That was it. I do appreciate your answer!!
        Autodesk is more than a little annoying with ridiculous defaults like this.

  3. r robinson says:

    Hello – We need to add alphanumerically listed Notes/Text to drawings with the number/letter being in a box or circle. We have not found any easy way to do this in AutoCad 13. If you know how to do this it would be very appreciated. RR

  4. Octavian says:

    hello, it does not work for me, im using a mac version of autocad 2013, what can be wrong?

  5. Michael says:

    Hello, Everything works fine except in my 2012, I need to enter the text in order for it to be placed (Yes, I did select my text first.) Any suggestions?

    Thank you!

  6. Michael says:

    EDIT for clarification:
    When I select the text, it does disappear (understandably), but I am prompted to Enter Text to complete the routine. In other words, it doesn’t keep my original text like in the little gifs posted.
    Any suggestions? Maybe a setting in my mleader settings or in text settings? (I have followed your suggestions for MLEADER settings.)
    Thank you.

  7. Wade says:

    Just tried that lisp routine… outstanding exactly what i was looking for

  8. Kelley says:

    Why does the text and arrow come in super small? thanks!

  9. Diego Gallego says:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s