Jump to content

Recommended Posts

Posted

is there a easy way to add an underline to all selected dtext?

Posted

I don't believe there is anything directly in AutoCAD that will do this, but I'm sure someone could create a LISP or possibly one is already existing that will do this for you. You can do this IF the text is all the same (like the same words) easily by adding the %%U prior to the text in the properties pane but that is only if all the text is the same (highly unlikely).

Posted

Give this a whirl:

 

(defun c:txt (/ ss str u)
 (vl-load-com)
 (initget 1 "U L REV UN RE")
 (if (and (setq u (getkword "\nUpper Lower UNderline REmove-Underline REVerse: "))
      (setq ss (ssget ":L" '((0 . "TEXT"))))
     )
   (foreach x (mapcar 'vlax-ename->vla-object
              (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
          )
     (setq str (vla-get-textstring x))
     (cond
   ((= u "U") (vla-put-textstring x (strcase str)))
   ((= u "L") (vla-put-textstring x (strcase str t)))
   ((and (= u "UN") (not (wcmatch (strcase str) "*%%U*")))
    (vla-put-textstring x (strcat "%%U" (vla-get-textstring x)))
   )
   ((= u "RE")
    (if (wcmatch (strcase str) "*%%U*")
      (vla-put-textstring x (vl-string-subst "" "%%U" (vla-get-textstring x)))
    )
   )
   ((= u "REV")
    (vla-put-textstring
      x
      (apply 'strcat (mapcar 'chr (reverse (vl-string->list str))))
    )
   )
     )
   )
 )
 (princ)
)

Posted
You could use this lisp (thanks to the unknown author) and use %%u as the prefix

 

Besides the Steelers, more good "stuff" from Pittsburgh, PA! :wink:

Posted

Why reinvent the wheel?

On the text formatting tool bar near the center, there is a U with a line under it. High lite the text you want underscored then click that button.

Posted
Why reinvent the wheel?

On the text formatting tool bar near the center, there is a U with a line under it. High lite the text you want underscored then click that button.

That would force the user to open every text object. She was hoping to avoid just that.

  • 2 months later...
Posted

sorry for the late reply got moved onto other things, ronjonp your lisp worked great, lpseifert when i download the attached lisp it is just a bunch of funky symbols. is there a way to make ronjonps lisp work with mtext? i tried exploding all my mtext back to dtext used the lisp then tried t2m (text2mtext lisp) but it just put %%u in front of everything and took out the underline

Posted

I think that this should work:

 

[b][color=BLACK]([/color][/b]defun c:ultext [b][color=FUCHSIA]([/color][/b]/ ss i en ed tv pre[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"*TEXT"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]setq i -1[b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1+ i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                   tv [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 1 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                  pre nil[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]cond [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]= [color=#2f4f4f]"TEXT"[/color]  [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 0 ed[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq pre [color=#2f4f4f]"%%U"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]= [color=#2f4f4f]"MTEXT"[/color] [b][color=RED]([/color][/b]cdr [b][color=PURPLE]([/color][/b]assoc 0 ed[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]setq pre [color=#2f4f4f]"\\L"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]and pre
                 [b][color=GREEN]([/color][/b]/= pre [b][color=BLUE]([/color][/b]substr tv 1 [b][color=RED]([/color][/b]strlen pre[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                 [b][color=GREEN]([/color][/b]entmod [b][color=BLUE]([/color][/b]subst [b][color=RED]([/color][/b]cons 1 [b][color=PURPLE]([/color][/b]strcat pre tv[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]assoc 1 ed[b][color=RED])[/color][/b] ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

-David

Posted

that works perfect thank you

Posted

You're welcome.

 

Here's a little tweak so that you don't add the prefix twice.

 

[color=#8b4513];;;UNDERLINE TEXT SELECTIONS[/color]
[b][color=BLACK]([/color][/b]defun c:ultext [b][color=FUCHSIA]([/color][/b]/ i ss en ed tv pf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq i -1
           ss [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"*TEXT"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1+ i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                   tv [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 1 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   pf [b][color=GREEN]([/color][/b]cond [b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]= [color=#2f4f4f]"TEXT"[/color]  [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 0 ed[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [color=#2f4f4f]"%%U"[/color][b][color=BLUE])[/color][/b]
                            [b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]= [color=#2f4f4f]"MTEXT"[/color] [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 0 ed[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [color=#2f4f4f]"\\L"[/color][b][color=BLUE])[/color][/b]
                            [b][color=BLUE]([/color][/b]T nil[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]and pf
                 [b][color=GREEN]([/color][/b]/= pf [b][color=BLUE]([/color][/b]strcase [b][color=RED]([/color][/b]substr tv 1 [b][color=PURPLE]([/color][/b]strlen pf[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                 [b][color=GREEN]([/color][/b]entmod [b][color=BLUE]([/color][/b]subst [b][color=RED]([/color][/b]cons 1 [b][color=PURPLE]([/color][/b]strcat pf tv[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]assoc 1 ed[b][color=RED])[/color][/b] ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

-David

  • 13 years later...
Posted
On 1/21/2010 at 10:51 PM, David Bethel said:

You're welcome.

 

Here's a little tweak so that you don't add the prefix twice.

 

 

[color=#8b4513];;;UNDERLINE TEXT SELECTIONS[/color]
[b][color=BLACK]([/color][/b]defun c:ultext [b][color=FUCHSIA]([/color][/b]/ i ss en ed tv pf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq i -1
           ss [b][color=MAROON]([/color][/b]ssget '[b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]0 . [color=#2f4f4f]"*TEXT"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1+ i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                   tv [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 1 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   pf [b][color=GREEN]([/color][/b]cond [b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]= [color=#2f4f4f]"TEXT"[/color]  [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 0 ed[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [color=#2f4f4f]"%%U"[/color][b][color=BLUE])[/color][/b]
                            [b][color=BLUE]([/color][/b][b][color=RED]([/color][/b]= [color=#2f4f4f]"MTEXT"[/color] [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 0 ed[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [color=#2f4f4f]"\\L"[/color][b][color=BLUE])[/color][/b]
                            [b][color=BLUE]([/color][/b]T nil[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]and pf
                 [b][color=GREEN]([/color][/b]/= pf [b][color=BLUE]([/color][/b]strcase [b][color=RED]([/color][/b]substr tv 1 [b][color=PURPLE]([/color][/b]strlen pf[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                 [b][color=GREEN]([/color][/b]entmod [b][color=BLUE]([/color][/b]subst [b][color=RED]([/color][/b]cons 1 [b][color=PURPLE]([/color][/b]strcat pf tv[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]assoc 1 ed[b][color=RED])[/color][/b] ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]
 

 

-David

Hi guys

Anyone could tell me that , whats these things in these codes::

 

[b][color=GREEN]([/color][/b]/= pre [b][color=BLUE]([/color]

 

and what exactly wheres use of them and whats that application of them.??

 

Posted

They are the control codes for the forum in an older style, if you download lisp code then remove them entirely then lisp will work. PS Hopefully.

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...