Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Uppercase to Lowercase LISP 4

Status
Not open for further replies.

10Gallen

Civil/Environmental
Mar 2, 2003
33
0
0
AU
Hi all,
Can anyone point me to a LISP routine for Autocad 2000 that will take a line of uppercase text and turn it into lowercase text?
Unfortunately the text is not MTEXT, so I suppose that a useful alternative routine would be one that turns several lines of text into an MTEXT block.
I have a lot of old R14 lisps which I can't get to all work in 2000, one of which does the UC/LC conversion.
Any help appreciated,
GAllen
 
Replies continue below

Recommended for you

Hi, 10Gallen:

Here goes your routine:

(defun C:TCASE ()

(prompt "\nTCASE - Change text strings to upper or lower case")

(setq SELECTION_SET (ssget))
(setq NO_OF_ITEMS (sslength SELECTION_SET))

(initget 1 "U L")
(setq NEWCASE
(getkword &quot;\nWhat case do you want to change them to <Upper or Lower> ? &quot;)
)

(if (equal NEWCASE &quot;U&quot;)
(setq CASEFLAG nil)
(setq CASEFLAG T)
)

(setq INDEX 0)

(repeat NO_OF_ITEMS

(setq ENTITY_NAME (ssname SELECTION_SET INDEX))
(setq OLD_ENTITY_LIST (entget ENTITY_NAME))
(setq ENTITY_TYPE (cdr (assoc 0 OLD_ENTITY_LIST)))

(if (equal ENTITY_TYPE &quot;TEXT&quot;)
(progn
(setq OLD_STRING (assoc 1 OLD_ENTITY_LIST))
(setq NEW_STRING
(cons 1 (strcase (cdr OLD_STRING) CASEFLAG))
)
(setq NEW_ENTITY_LIST
(subst NEW_STRING OLD_STRING OLD_ENTITY_LIST)
)
(entmod NEW_ENTITY_LIST)
)
)

(setq INDEX (1+ INDEX))

)

(prompt &quot;\nProgram complete.&quot;)
(princ)
)

Hope that helps,
Roberto.
 
If you are familiar with lisp and vba then you can create this with a few lines of code. And since I know you probably don't want to have to do any coding, I will send it to you, so you can do with it as you like. It it written entirely in VBA all you need to do is extract the code to the ACAD2000 support path and add CAPITAL.DVB to the startup suite. The first time you run it, you will have to select it from the macro list on the tools menu, from that point, it will create a toolbar button and all you need to do is select it.
 
Roberttx - thanks muchly, works a treat!

Striker - I don't have any experience with VBA at all, I'm pretty much a hack drafty (engineer in other words ;) ).

Thanks
GAllen
 
It looks like roberttx wrote this specifically for this problem. Since it helped out, and since it probably took more than 10 seconds to do, proper etiquette would be to click the &quot;Mark this post as helpful/expert post&quot; at the bottom of his thread.

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Striker, I would appreciate a copy as well if you have the time. Although my intent is to go from lower to upper.

D55
ddoggett@winkdavis.com
 
Hi,

here's my standard reply: Use Express Tools V1-9!!
Search in this forum for the download-link.
-> then You can write:
· Sentence case
· lowercase
· UPPERCASE
· Title
· tOGGLE cASE

regards Lothar

Win NT4.0(SP6),2000(SP3)
AC 2000i(SP2), ADT 3.0(SP3),
AC 2002, ADT 3.3,
AC 2004, ADT 2004
 
express tools that is included with ACAD 2002 (not sure about 2000) has both items you mentioned, &quot;change textcase&quot; and &quot;text to mtext&quot;
 
Status
Not open for further replies.
Back
Top