Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Contributor
richdclemons
Posts: 48
Registered: ‎03-11-2003
Message 1 of 7 (1,311 Views)

Convert Quick Leader to Multileader?

1311 Views, 6 Replies
09-19-2008 08:30 AM
Does anyone have a routine or know of one that will convert Quick Leaders to Multileaders?
Contributor
Ktiger12
Posts: 24
Registered: ‎09-23-2008
Message 2 of 7 (1,311 Views)

Re: Convert Quick Leader to Multileader?

10-02-2008 02:18 PM in reply to: richdclemons
Here is a little lisp I created awhile back. Hope it work for you.

;LEADER2MULTILEADER
;Converts autocad leaders with text or mtext to autocad 2008+ multileaders
;created by Jeffery Allen - 11/1/2007

(defun C:LD2MLD (/ ent1 ent1-gcode ent1-type leader-pt-list leader-1st-pt leader-2nd-pt
ent2 ent2-gcode ent2-type text-strg)

(setq ent1(car(entsel "\nSelect a Leader: "))
ent1-gcode(entget ent1)
ent1-type(cdr(assoc 0 ent1-gcode))
)
(if(= ent1-type "LEADER")
(progn
(setq leader-pt-list(member(assoc 10 ent1-gcode) ent1-gcode)
leader-1st-pt(cdr(car leader-pt-list))
leader-2nd-pt(cdr(cadr leader-pt-list))
ent2(car(entsel "\nSelect Text or Mtext: "))
ent2-gcode(entget ent2)
ent2-type(cdr(assoc 0 ent2-gcode))
)
(if(or(= ent2-type "TEXT")(= ent2-type "MTEXT"))
(progn
(setq text-strg(cdr(assoc 1 ent2-gcode)))
(setvar "OSMODE" (boole 7 (getvar "OSMODE") 16384));osnap off
(setvar "CMDECHO" 0);command echo off
(command "_.ERASE" ent1 ent2 ""
"_.MLEADER" leader-1st-pt leader-2nd-pt text-strg
)
(setvar "CMDECHO" 1);command echo on
(setvar "OSMODE" (boole 2 (getvar "OSMODE") 16384));osnap on
)
)
(if(and(/= ent2-type "TEXT")(/= ent2-type "MTEXT"))(alert "Object selected is not a text or mtext"))
)
)
(if(/= ent1-type "LEADER")(alert "Object selected is not a leader"))
(princ)
);defun

(setq message "Leader 2 Multileader loaded...

Converts autocad leaders with text or
mtext to autocad 2008+ multileaders

Created by Jeffery Allen - 11/1/2007

Start command with \"LD2MLD\"")
(alert message)
(setq message nil)
(princ)

(c:LD2MLD)
Contributor
Ktiger12
Posts: 24
Registered: ‎09-23-2008
Message 3 of 7 (1,311 Views)

Re: Convert Quick Leader to Multileader?

10-02-2008 02:18 PM in reply to: richdclemons
Here is a little lisp I created awhile back. Hope it work for you.

;LEADER2MULTILEADER
;Converts autocad leaders with text or mtext to autocad 2008+ multileaders
;created by Jeffery Allen - 11/1/2007

(defun C:LD2MLD (/ ent1 ent1-gcode ent1-type leader-pt-list leader-1st-pt leader-2nd-pt
ent2 ent2-gcode ent2-type text-strg)

(setq ent1(car(entsel "\nSelect a Leader: "))
ent1-gcode(entget ent1)
ent1-type(cdr(assoc 0 ent1-gcode))
)
(if(= ent1-type "LEADER")
(progn
(setq leader-pt-list(member(assoc 10 ent1-gcode) ent1-gcode)
leader-1st-pt(cdr(car leader-pt-list))
leader-2nd-pt(cdr(cadr leader-pt-list))
ent2(car(entsel "\nSelect Text or Mtext: "))
ent2-gcode(entget ent2)
ent2-type(cdr(assoc 0 ent2-gcode))
)
(if(or(= ent2-type "TEXT")(= ent2-type "MTEXT"))
(progn
(setq text-strg(cdr(assoc 1 ent2-gcode)))
(setvar "OSMODE" (boole 7 (getvar "OSMODE") 16384));osnap off
(setvar "CMDECHO" 0);command echo off
(command "_.ERASE" ent1 ent2 ""
"_.MLEADER" leader-1st-pt leader-2nd-pt text-strg
)
(setvar "CMDECHO" 1);command echo on
(setvar "OSMODE" (boole 2 (getvar "OSMODE") 16384));osnap on
)
)
(if(and(/= ent2-type "TEXT")(/= ent2-type "MTEXT"))(alert "Object selected is not a text or mtext"))
)
)
(if(/= ent1-type "LEADER")(alert "Object selected is not a leader"))
(princ)
);defun

(setq message "Leader 2 Multileader loaded...

Converts autocad leaders with text or
mtext to autocad 2008+ multileaders

Created by Jeffery Allen - 11/1/2007

Start command with \"LD2MLD\"")
(alert message)
(setq message nil)
(princ)

(c:LD2MLD)
Active Contributor
richdclemons
Posts: 48
Registered: ‎03-11-2003
Message 4 of 7 (1,311 Views)

Re: Convert Quick Leader to Multileader?

10-03-2008 07:53 AM in reply to: richdclemons
Jeffery, you are a life saver my friend...this routine works like a charm!

Thanks!!
Contributor
Ktiger12
Posts: 24
Registered: ‎09-23-2008
Message 5 of 7 (1,311 Views)

Re: Convert Quick Leader to Multileader?

10-07-2008 10:13 AM in reply to: richdclemons
your welcome
Contributor
jshorttiller
Posts: 22
Registered: ‎03-25-2011
Message 6 of 7 (77 Views)

Re: Convert Quick Leader to Multileader?

08-07-2014 04:23 PM in reply to: Ktiger12

I realize this is old, but I just found it and I love it. You saved me so much time.

 

Question, will this load everytime I open cad (2015)

Active Contributor
RJanw01
Posts: 34
Registered: ‎10-15-2008
Message 7 of 7 (68 Views)

Re: Convert Quick Leader to Multileader?

08-08-2014 05:53 AM in reply to: jshorttiller

If you add it to your acad.lsp to load or in the startup suite it will load every time. Also make sure it is in the support file search path.

 

I have used similar lisps and made a small addition to it. If you notice it changes the qleader to the current mleader style. We have 6 different mleader styles we use so I added a setting of the mleader style and just modified the defun for which style I wanted. ex. 4" text = l2m4, 3" = l2m3, etc.

 

(defun c:L2M4 ()
(setvar "cmleaderstyle" "your Multileader style name here")

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.