CadProWannabe Posted January 5, 2010 Posted January 5, 2010 (if (= (strcase txt) "AC") (setq txt "PV") ) When the raw discription of the point matches AC then this will set a text entitiy of PV. My problem is that this will only work if the text string matches word for word. Is there a way to word this so that I can use a wildcard.. Say for example any text string that contains AC set txt to equal PV. Examples ED AC, AC GB, AC, etc these would all need to equal PV I am using Autocad Landdesktop 2006, I am not very good at this lisp stuff any help would be appreciated. Quote
LEsq Posted January 5, 2010 Posted January 5, 2010 Maybe... (setq txt "externalgboundary") ;; this one contains GB (setq txt (if (wcmatch (strcase txt) "*ED*,*AC*,*GB*") "PV" txt)) "PV" But wait for the lisp masters... and on the mean time have a look about 'wcmatch' HTH Quote
wizman Posted January 5, 2010 Posted January 5, 2010 Have a look at wcmatch function (if (wcmatch (strcase txt) "*AC*") ... OOps Same with LE's post above Quote
ollie Posted January 5, 2010 Posted January 5, 2010 (if (= (strcase txt) "AC") (setq txt "PV") ) When the raw discription of the point matches AC then this will set a text entitiy of PV. My problem is that this will only work if the text string matches word for word. Is there a way to word this so that I can use a wildcard.. Say for example any text string that contains AC set txt to equal PV. Examples ED AC, AC GB, AC, etc these would all need to equal PV I am using Autocad Landdesktop 2006, I am not very good at this lisp stuff any help would be appreciated. If you know regex (grep) you will be fine. As commented above the wcmatch function is your best bet but regex style expressions can be used in selection sets ollie Quote
Lee Mac Posted January 5, 2010 Posted January 5, 2010 But wait for the lisp masters.... But you had already arrived... Quote
CAB Posted January 6, 2010 Posted January 6, 2010 One more: (if (vl-string-search "AC" (strcase txt)) (setq txt "PV") ) Quote
Gipslove4u Posted April 18, 2014 Posted April 18, 2014 I'm new to lisp routines and trying to use wildcard in lisp to rename bunch of Text Style names and change a common part of them (similar to find & Replace, but can't get it to work. Maybe I'm doing something wrong? For example, I have Text Style names something like: T10206-UC07-P0ZEN-110001-R7A-WIP$0$_HZTXT T10206-UC07-P0ZEN-110001-R7A-WIP$0$ARIAL T10206-UC07-P0ZEN-110001-R7A-WIP$0$GHS T10206-UC07-P0ZEN-110001-R7A-WIP$0$HG And I want to remove the "T10206-UC07-P0ZEN-110001-R7A-WIP$0$" _HZTXT ARIAL GHS HG or atlest change this sh#t to something meaningful i.e. "Old" Old_HZTXT Old ARIAL Old GHS Old HG This is what I have written so far (ok, this may look stupid… but as I told you I’m new to lisps ): (setq txtStyleName (tblobjname "style" (if (wcmatch (strcase txt) "T10206-UC07-P0ZEN-110001-R7A-WIP$0$*"))")) (if (/= txtStyleName nil) (command "-RENAME" "Style" "txtStyleName" "")) OR (setq txtStyleName (tblobjname "style" (if (wcmatch (strcase txt) "T10206-UC07-P0ZEN-110001-R7A-WIP$0$*"))")) (if (/= txtStyleName nil) (command "-RENAME" "Style" "txtStyleName" "Old")) But none of these works.. :twisted: Quote
hmsilva Posted April 18, 2014 Posted April 18, 2014 Something like this perhaps (while (setq St (tblnext "STYLE" (null St))) (setq StLst (cons (strcase (cdr (assoc 2 St))) StLst)) );; while (foreach st StLst (if (wcmatch st "T10206-UC07-P0ZEN-110001-R7A-WIP$0$*") (progn (setq i 0) (while (setq pos (vl-string-search "$" st i)) (setq i (1+ pos)) );; while (setq newst (substr st (1+ i))) (command "-RENAME" "Style" st (strcat "Old " newst)) );; progn );; if );; foreach HTH Henrique Quote
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.