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…
~enjoy
Links to other multileader routines:
https://autocadtips.wordpress.com/2011/06/17/autolisp-add-leader-to-mtext-or-dtext/
https://autocadtips.wordpress.com/2012/03/12/add-leader-to-text-make-multileader/
https://autocadtips.wordpress.com/2012/03/12/autolisp-covert-dtext-mtext-to-multileaders/
;;; 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) (vl-load-com) (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 'strcat (mapcar 'cdr (vl-sort (mapcar '(lambda (x) (cons (vlax-get x 'insertionpoint) (strcat (vlax-get x 'textstring) " ") ) ) (setq ss (mapcar 'vlax-ename->vla-object (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) ) ) (princ) )
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.
My Mleader has the landing underlining all my first line of text if I lead to the right but not to the left??
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”
~Greg
Thanks! That was it. I do appreciate your answer!!
Autodesk is more than a little annoying with ridiculous defaults like this.
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
I would suggest Lee-Mac’s Incremental numbering routine. There are plenty of options and it is free.
http://www.lee-mac.com/numinc.html
hello, it does not work for me, im using a mac version of autocad 2013, what can be wrong?
Unfortunately, AutoCAD for mac doesn’t use Visual LISP and that is what this code uses. Your best bet is to find a pure AutoLISP version.
Here is a link to Autodesk where they show what is included and not included with using AutoCAD for Mac. http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=15833488&linkID=15839490
Even better is to not use AutoCAD for mac. That may seems harsh, but it should be called AutoCAD for mac LT. I can only imagine how frustrating it is to have the appearance of a full AutoCAD but to learn that it is almost as stripped as AutoCAD LT
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!
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.
Just tried that lisp routine… outstanding exactly what i was looking for
Why does the text and arrow come in super small? thanks!
COPIO EL TESTO Y LO PEGO EN UN TXT. ĀæCON QUE EXTENSION LO GUARDO Y COMO LO ACTIVO EN AUTOCAD?