Print Page | Close Window

%%U

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=13478
Printed Date: 03.Jun.2026 at 14:43


Topic: %%U
Posted By: marie_b
Subject: %%U
Date Posted: 05.Aug.2020 at 22:07
I have a file that I can only use Single Line text in.  Some things need to be underlined so I use the control U command.  This adds %%U to the contents of the text.  My problem is this file is imported into Corel Draw and the %%U causes issues.  It will only work ok with %%u.  Is there a way to change this command so it adds a little u instead of a capital U?  Or is there any way to find/replace the U with a u?

Thanks!



Replies:
Posted By: philippe JOSEPH
Date Posted: 06.Aug.2020 at 11:36
Helo marie_b, try the command FIND or _FIND. It works with a selection of entities or with all the drawing.


Posted By: marie_b
Date Posted: 06.Aug.2020 at 15:45
Thanks for the reply.

That does not work because it is a code and not actually recognized as text.


Posted By: Kent Cooper
Date Posted: 12.Aug.2020 at 14:43
Try this:

(defun C:Utou (/ ss n txt str)
  (if (setq ss (ssget "_X" '((1 . "*%%U*"))))
    (repeat (setq n (sslength ss)); then
      (setq
        txt (ssname ss (setq n (1- n)))
        str (getpropertyvalue txt "TextString")
      ); setq
      (while (wcmatch str "*%%U*")
        (setq str (vl-string-subst "%%u" "%%U" str))
      ); while
      (setpropertyvalue txt "TextString" str)
    ); repeat
  ); if
  (princ)
); defun

Minimally tested.  [Curiously under these circumstances, but typically for defined commands, the command name is not case-sensitive.]


Posted By: marie_b
Date Posted: 12.Aug.2020 at 14:48
I don't know much about programming.  What exactly do I do with it?


Posted By: marie_b
Date Posted: 12.Aug.2020 at 15:40
Never mind, I got it figured out.  And it works!

Thank you from the whole support team! Clap



Print Page | Close Window