Author Topic: Changing DText from Sentance case to upper case  (Read 1499 times)

0 Members and 1 Guest are viewing this topic.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Changing DText from Sentance case to upper case
« on: July 23, 2008, 11:29:59 AM »
Does anyone know of a way to change LOTS of DText from Sentance case to Upper case?

Many thanks in advance
T :-)
Thanks for explaining the word "many" to me, it means a lot.

Rob...

  • King Gator
  • Posts: 3824
  • Take a little time to stop and smell the roses.
Re: Changing DText from Sentance case to upper case
« Reply #1 on: July 23, 2008, 11:33:42 AM »
Express\Text\Change Text Case
CAD Tech

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Changing DText from Sentance case to upper case
« Reply #2 on: July 23, 2008, 12:01:41 PM »
OOh thanks RobDraw.

I'd never noticed that one hiding at the bottom of the Express tools menu :)
Thanks for explaining the word "many" to me, it means a lot.

Rob...

  • King Gator
  • Posts: 3824
  • Take a little time to stop and smell the roses.
Re: Changing DText from Sentance case to upper case
« Reply #3 on: July 23, 2008, 12:06:45 PM »
Glad to help.
CAD Tech

ronjonp

  • Needs a day job
  • Posts: 7535
Re: Changing DText from Sentance case to upper case
« Reply #4 on: July 23, 2008, 12:21:10 PM »
Here's something I threw together a while back:

Code: [Select]
(defun c:txt (/ u str cnt bstr neg ss)
  (initget 1 "U L R M UN RE")
  (setq u    (getkword
       "\n(U)pper (L)ower (M)ixed (R)everse (UN)derline (RE)move Underline: "
     )
bstr ""
neg  -1
cnt  1
  )
  (if (setq ss (ssget '((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)
)
)
((= u "UN")
(if (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 "R")
(repeat (strlen str)
   (setq bstr (strcat (substr str cnt 1) bstr)
cnt  (1+ cnt)
   )
)
(vla-put-textstring x bstr)
(setq bstr ""
       cnt 1
)
)
((= u "M")
(setq cnt (strlen str))
(repeat (strlen str)
   (if (minusp neg)
     (setq bstr (strcat (strcase (substr str cnt 1)) bstr)
   neg 1
     )
     (setq bstr (strcat (strcase (substr str cnt 1) T) bstr)
   neg -1
     )
   )
   (setq cnt (1- cnt))
)
(vla-put-textstring x bstr)
(setq bstr ""
       cnt 1
)
)
      )
    )
  )
  (princ)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC