jonathann3891 Posted March 19, 2015 Share Posted March 19, 2015 (edited) Can this lisp be edited to work on mleader text boxes? It shirinks the text box to the minimum requirement to cover the text. (defun c:MTL (/ sset en el ymt nmt mtwidth mtcont) (setq sset (ai_aselect)) (if (null sset) (progn (princ "\nNo objects selected.") (exit) ) ) (setq COUNT 0) (setq ymt 0) (setq nmt 0) (if (/= sset nil)(setq EN (ssname sset COUNT))(setq EN nil)) (WHILE (/= EN nil) (setq mtcont nil) (setq nel nil) (setq EL (entget EN)) (if (= (cdr (assoc 0 EL)) "MTEXT") (progn (setq mtwidth (* (cdr (assoc 42 el))1.015)) (setq EL (subst (cons 41 mtwidth) (assoc 41 EL) EL)) (progn (setq nel el) (while (/= (assoc 3 nel) nil) (setq mtcont (if (= mtcont nil) (cdr (assoc 3 nel)) (strcat mtcont (cdr (assoc 3 nel))) ) ) (setq nel (vl-remove (assoc 3 nel) nel)) ) (if (= mtcont nil) (setq mtcont (cdr (assoc 1 nel))) (setq mtcont (strcat mtcont (cdr (assoc 1 nel)))) ) (setq el nel) ) (setq EL (subst (cons 1 mtcont) (assoc 1 EL) EL)) (if (= (cdr (assoc 90 EL)) 2) (setq el (vl-remove (assoc 90 EL) EL)) ) (entmod EL) (entupd en) (setq el (entget en '("ACAD"))) (if (/= (assoc -3 el) nil) (progn (setq oheight (assoc 1040 (cdadr (assoc -3 el)))) (setq nheight (cons 1040 (cdr (assoc 43 el)))) (setq n-3 (list (cons -3 (list (subst nheight oheight (cadr (assoc -3 el))))))) (setq el (vl-remove (assoc -3 el) el)) (setq el (append el n-3)) ) ) (entdel (cdr (assoc -1 el))) (entmake el) (setq COUNT (1+ COUNT)) (setq EN (SSNAME sset COUNT)) (setq ymt (1+ ymt)) ) (progn (setq COUNT (1+ COUNT)) (setq EN (SSNAME sset COUNT)) (setq nmt (1+ nmt)) ) ) ) (prompt (strcat "\n" (itoa ymt) " Mtext object(s) were resized, and " (itoa nmt) " object(s) were not Mtext.")) (princ) ) Edited March 19, 2015 by jonathann3891 Quote Link to comment Share on other sites More sharing options...
abra-CAD-abra Posted March 22, 2015 Share Posted March 22, 2015 Hi jonathann3891, Refer to post #4 here, by Lee Mac. Cheers. Quote Link to comment Share on other sites More sharing options...
jonathann3891 Posted March 23, 2015 Author Share Posted March 23, 2015 Thank you! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 23, 2015 Share Posted March 23, 2015 Thanks for the recommendation abra-CAD-abra! I'm glad the code helps jonathann. Quote Link to comment Share on other sites More sharing options...
jonathann3891 Posted March 23, 2015 Author Share Posted March 23, 2015 The only problem with the code is that it will shrink the horizontal limits to fix the text, but it stretches the vertical limits. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.