Add Leader to Text – Make Multileader

If you have existing MTEXT objects and would like to add a leader to it and make into a Multileader object, this LISP will be your friend. The text objects do need to be MTEXT objects for this routine to work correctly. So you may need to use the TXT2MTXT command (express tools).

Here’s how:

  • MT2ML <enter> to start
  • Select the MTEXT object that you’d like to add a  leader to.
  • Specify where the arrow portion of the leader should go.
  • Specify the first vertex of the leader.

Once you have the leader set – hit <enter> to complete.

(defun c:mt2ml ( / oobj nobj nstrg)
  (setq oobj (vlax-ename->vla-object (car (nentsel "\nSelect source text: "))))
  (if (= (vlax-get-property oobj 'ObjectName) "AcDbMText")
    (setq nstrg (vlax-get-property oobj 'TextString))
  (command "_MLEADER")
  (while (= 1 (logand (getvar "CMDACTIVE") 1)) (command PAUSE))
  (setq nobj (vlax-ename->vla-object (entlast)))
  (if (= (vlax-get-property nobj 'ObjectName) "AcDbMLeader")
    (vlax-put-property nobj 'TextString nstrg)
  (entdel (vlax-vla-object->ename oobj))

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: Text, Leaders, Text. Bookmark the permalink.

8 Responses to Add Leader to Text – Make Multileader

  1. Pingback: Text to Multileader | AutoCAD Tips

  2. j says:

    Hi couldnt find another spot for this,

    My question, just got 2013 installed here at work and the txt2mtxt does not work at all even after installing expresstools and restarting autocad. Any way around this?

  3. JD says:

    I stumbled upon this looking for a way to re-attach a leader to the text. Im having the same problem as j did… Though, Im using 2012. ExpressTools is installed, but I get “Unknown command “MT2ML”. Press F1 for help.”

  4. Yadira Mejia says:

    How do I change this code to combine with a leader instead of a multileader? I changed the parts where mleader is called but after drawing the leader AutoCAD freezes.

  5. Jennifer says:

    This is great! Thanks so much for sharing! A tip to anyone who reads this far down: prior to running the MT2ML command set the dimstyle, layer, and annotation scale you want the MLeader on and the Mtext will convert to the Mleader with those settings

Leave a Reply

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

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

Facebook photo

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

Connecting to %s