Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Kent1Cooper
en respuesta a: cleftwich

I assume you mean underlining the entire content.  Try this quickie:

(defun C:UMT (/ ss n edata); = Underline MText(s)
  (if (setq ss (ssget "_:L" '((0 . "MTEXT"))))
    (repeat (setq n (sslength ss)); then
      (setq edata (entget (ssname ss (setq n (1- n)))))
      (entmod
        (subst
          (cons 1 (strcat "{\\L" (cdr (assoc 1 edata))))
          (assoc 1 edata)
          edata
        ); subst
      ); entmod
    ); repeat
  ); if
  (princ)
); defun

It's possible that if a given Mtext object has other internal formatting at the beginning, something could be thrown off.  It could be made to check whether there's already underlining code at the beginning before applying it, but in a quick test, having two of them doesn't seem to bother it.  Nor does not  having the  }  at the end that manual underlining supplies, but that can be added:

  (cons 1 (strcat "{\\L" (cdr (assoc 1 edata)) "}"))

Kent Cooper, AIA