ali888 Posted February 15, 2007 Share Posted February 15, 2007 Hi, I need help with the following issue I have got a drawing that contains lots of text. The problem is that i need to turn them into UpperCase text and there are heaps of them. It'd be time consuming if i do it one by one. wonder if there're any easier way of doing this? I'm using autocad 2005 Thank you in advance Quote Link to comment Share on other sites More sharing options...
CarlB Posted February 15, 2007 Share Posted February 15, 2007 If you have Express Tools installed, use the TCASE command to change case of selected text. Quote Link to comment Share on other sites More sharing options...
Guest Alan Cullen Posted February 15, 2007 Share Posted February 15, 2007 If you have Express Tools you can do it easily..... Express -> Text -> Change Text Case. Otherwise use the following lisp routine (I have no idea who the original author was...I've had it for ages). Just pick everything....it only works on text.... (DeFun C:UPCASE (/ SS ENAME EDATA INDEX TEMP TEXT COUNT) (prompt "\nSelect Text: ") (if (SetQ SS (SSGet)) (ProgN (SetQ INDEX -1 COUNT 0) (While (SetQ ENAME (SSName SS (SetQ INDEX (1+ INDEX)))) (SetQ EDATA (EntGet ENAME)) (If (Eq (Cdr (Assoc 0 EDATA)) "TEXT") (Progn (SetQ TEMP (Assoc 1 EDATA) TEXT (StrCase (Cdr TEMP)) EDATA (SubSt (Cons 1 TEXT) TEMP EDATA) COUNT (1+ COUNT) ) (EntMod EDATA) ))) (PrinC (StrCat "\n" (IToA COUNT) " text entities changed.")) )) (PrinC) ) Quote Link to comment Share on other sites More sharing options...
ali888 Posted February 15, 2007 Author Share Posted February 15, 2007 Thank you Allan and CarlB for your replies. I have AutoCAD 2005 full version but i couldn't find it. I think i need to install it from the Autocad CD. Sadly, i misplaced the CD and don't know where it is Allan, I tried the code you gave me and it works beautifully. However, it only works with TEXT only. How do i make it to work with MTEXT? because some of the text are made up using MTEXT rather than TEXT. Thank you in advance Quote Link to comment Share on other sites More sharing options...
Guest Alan Cullen Posted February 15, 2007 Share Posted February 15, 2007 Without getting too involved in tweaking the code.....for the time being just make a copy of the code to another name for MTEXT.....and edit the following line from.... "TEXT") to.... "MTEXT") Alternatively just change the line "TEXT") to "MTEXT,TEXT") i DON'T KNOW IF IT WILL WORK ON mtext,,,,BUT WORTH A GO.... Quote Link to comment Share on other sites More sharing options...
CarlB Posted February 15, 2007 Share Posted February 15, 2007 Try this tweaking of Alan's code, modified to just select text and mtext, changes either; (DeFun C:UPCASE (/ SS ENAME EDATA INDEX TEMP TEXT COUNT) (prompt "\nSelect Text: ") (if (SetQ SS (SSGet '((0 . "TEXT,MTEXT")))) (ProgN (SetQ INDEX -1 COUNT 0) (While (SetQ ENAME (SSName SS (SetQ INDEX (1+ INDEX)))) (SetQ EDATA (EntGet ENAME)) (SetQ TEMP (Assoc 1 EDATA) TEXT (StrCase (Cdr TEMP)) EDATA (SubSt (Cons 1 TEXT) TEMP EDATA) COUNT (1+ COUNT) ) (EntMod EDATA) ) ) (PrinC (StrCat "\n" (IToA COUNT) " text entities changed.")) ) (PrinC) ) Quote Link to comment Share on other sites More sharing options...
Guest Alan Cullen Posted February 15, 2007 Share Posted February 15, 2007 Thanks Carl......much neater tweaking of the code... Quote Link to comment Share on other sites More sharing options...
ASMI Posted February 15, 2007 Share Posted February 15, 2007 The code above is good, however can process MText not more longly 255 symbols, because such quantity of symbols contains in one DXFgroup (1 . "..."). I shall show the example on VisualLisp: (defun c:upc(/ allTxt okCount errCount curStr) (vl-load-com) (princ "\n <<< Select Text and MText >>> ") (if (setq allTxt (ssget '((0 . "TEXT,MTEXT")))) (progn (setq allTxt (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex allTxt)))) okCount 0 errCount 0); end setq (vla-StartUndoMark (setq actDoc (vla-get-ActiveDocument (vlax-get-acad-object)))) (foreach txt allTxt (setq curStr (strcase (vla-get-TextString txt))) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Textstring (list txt curStr))) (setq errCount(1+ errCount)) (setq okCount(1+ okCount)) ); end if ); end foreach (vla-EndUndoMark actDoc) (princ (strcat "\n"(itoa okCount) " texts now changed to uppercase. Wait regeneration...")) (if(/= 0 errCount) (princ (strcat "\n"(itoa errCount) " were on locked layer! ")) ); end if ); end progn (princ ">>> Empty selection! <<< ") ); end if (princ) ); end of c:upc Quote Link to comment Share on other sites More sharing options...
sinnerboy Posted January 18, 2012 Share Posted January 18, 2012 This lisp routine is good - however - it inserts XQL; in front of parts of text which is already upper case. Example - I have a drawing where each line of text begins with an upper case letter . " Maintain full insulation cover..." becomes XQL;MAINTAIN INSULATION COVER .... Any fix for this please ? Quote Link to comment Share on other sites More sharing options...
SLW210 Posted January 18, 2012 Share Posted January 18, 2012 Which routine are you using? Quote Link to comment Share on other sites More sharing options...
sinnerboy Posted January 18, 2012 Share Posted January 18, 2012 I've tried 2 - ASMI's and CarlB's . Both insert the XQL; bit Quote Link to comment Share on other sites More sharing options...
SLW210 Posted January 18, 2012 Share Posted January 18, 2012 Must be on your end, works fine here. Can you post a file with some of the text? Quote Link to comment Share on other sites More sharing options...
Arepo Posted July 18, 2012 Share Posted July 18, 2012 (edited) Must be on your end, works fine here. Can you post a file with some of the text? Here's some sample text that inserts XQL when changed to UpperCase using CarlB's program. ToUpperCaseTest.dwg Edited July 18, 2012 by Arepo Quote Link to comment Share on other sites More sharing options...
SLW210 Posted July 18, 2012 Share Posted July 18, 2012 \pxql; is a justification control for Mtext. Just click the paragraph alignment button or preferred method to make Mtext all one case is in Mtext Editor, Select All, then Right-Click and Change Case or click one of the buttons. [ATTACH=CONFIG]36023[/ATTACH] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.