Originally Posted by
cadconcepts
Hi Everyone:
I am trying to write a routine that will adjust the bounding (grips) around mtext so that it is tight up against the text. The problem has been that over time people have stretch the grips all over the place and it is sometimes difficult to find the grips without having to zoom way out. I wrote this routine that will 'eventually' adjust both the width and height. However, I cannot get the routine to adjust both directions at one time. If I move the code around, I can only get it to adjust in one direction or another. Any help is greatly appreciated.
Manuel A. Ayala
(Defun c:mtextfix (/ sset cntr ent entlst nmtextlen)
(princ "\nMTEXT Wrap Fix: ")
(prompt "\nSelect MTEXT to fix or <Enter for All>: ")
(setq sset (ssget "+.:S:E" (list (cons 0 "MTEXT"))))
(if (null sset)
(progn
(princ "\nAll text is now selected, Filter text down by: ")
(setq sset (ssget "x" (list (cons 0 "MTEXT"))))
)
)
(if sset
(progn
(setq cntr 0)
(repeat (sslength sset)
(setq ent (ssname sset cntr))
(setq entlst (entget ent))
(setq nmtextlen (dxf 42 entlst))
(entmod (subst (cons 46 0)(assoc 46 entlst) entlst))
(entmod (subst (cons 41 nmtextlen)(assoc 41 entlst) entlst))
(entupd ent)
(setq cntr (1+ cntr))
)
)
)
(princ)
)