johnengineer Posted April 4, 2007 Posted April 4, 2007 How would I be able to use the list and 'filter command in order to search for wildcards in a string of text? Quote
tzframpton Posted April 4, 2007 Posted April 4, 2007 are you simply wanting to find just text anywhere within the drawing? if you're wanting to do no more than that, use the FIND command. if it's any info more than that, someone else would have to get an answer to ya. Quote
johnengineer Posted April 4, 2007 Author Posted April 4, 2007 I would like Autocad to select all the text within a drawing containing a specific wildcard. Quote
DANIEL Posted April 4, 2007 Posted April 4, 2007 the asteric as the wild card plus what ever else for example * HOLES would select every piece of text with the word HOLES at the end of it Quote
DANIEL Posted April 4, 2007 Posted April 4, 2007 note that this will not work on mtext leader text or dimension text, if theres a way I am not aware of it Quote
tzframpton Posted April 4, 2007 Posted April 4, 2007 *thread jack* Daniel, heard you guys got some serious storms last night.... how's the trees/roofs in your area? Quote
DANIEL Posted April 5, 2007 Posted April 5, 2007 *thread jack* Daniel, heard you guys got some serious storms last night.... how's the trees/roofs in your area? we got some hail but really that was about it, heard that a funnel cloud try'd to form but i didnt see anything, all the sirens went off though. there wasn't even a breeze so no wind damage. Quote
ASMI Posted April 5, 2007 Posted April 5, 2007 More advanced search patterns available via lisp. For example search Text and MText with WCMATCH function patterns: (defun c:wildsearch(/ wPat tSet tLst mSet) (vl-load-com) (if (and (setq wPat (getstring T "\nSpecify search pattern: ")) (setq tSet(ssget "_X" '((0 . "TEXT,MTEXT")))) ); end and (progn (setq tLst(mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex tSet)))) mSet(ssadd) ); end setq (foreach ent tLst (if (wcmatch(vla-get-TextString ent)wPat) (ssadd(vlax-vla-object->ename ent)mSet) ); end if ); end foreach (if mSet (progn (sssetfirst nil mSet) (princ (strcat(itoa(sslength mset)) " selected ")) ); end progn (princ "\nNothing found. ") ); end if ); end progn ); end if (princ) ); end of c:wildsearch Available pattern symbols from WCMATCH function help: # (pound) Matches any single numeric digit @ (at) Matches any single alphabetic character . (period) Matches any single nonalphanumeric character * (asterisk) Matches any character sequence, including an empty one, and it can be used anywhere in the search pattern: at the beginning, middle, or end ? (question mark) Matches any single character ~ (tilde) If it is the first character in the pattern, it matches anything except the pattern [...] Matches any one of the characters enclosed [~...] Matches any single character not enclosed – (hyphen) Used inside brackets to specify a range for a single character , (comma) Separates two patterns ` (reverse quote) Escapes special characters (reads next character literally) You can use several patterns separated by comma. Quote
RFRUSSO Posted April 5, 2007 Posted April 5, 2007 I just cut and copied this from a post that I replied to yesterday but it seems to aply: I love the filter command. It is perhaps one of my most used power moves in CAD Here is what you do: First with Mtext type "I like Cats" Then type "I like dogs" Then type "I hate fish" Type filter at the command line. When the pop up window comes up click on the "Add Selected Object" button, and then select "I like Cats" In the dialog box there will be a bunch of stuff listed. Delete every thing accept: Object = text Text Value = I like cats Now click on The Text Value line, and click the edit item button in the Selected filter column you will see "I like cats" appear. Replace that text with *like* and then click add to list. Now go back and delete the text value that reads I like cats. Click apply and select all of the text on your drawing. Only the lines that say I like cats, and I like dogs will be selected. Apply the same principal to your actual work and there you have it Quote
adnhmz Posted May 29, 2012 Posted May 29, 2012 I just cut and copied this from a post that I replied to yesterday but it seems to aply: I love the filter command. It is perhaps one of my most used power moves in CAD Here is what you do: First with Mtext type "I like Cats" Then type "I like dogs" Then type "I hate fish" Type filter at the command line. When the pop up window comes up click on the "Add Selected Object" button, and then select "I like Cats" In the dialog box there will be a bunch of stuff listed. Delete every thing accept: Object = text Text Value = I like cats Now click on The Text Value line, and click the edit item button in the Selected filter column you will see "I like cats" appear. Replace that text with *like* and then click add to list. Now go back and delete the text value that reads I like cats. Click apply and select all of the text on your drawing. Only the lines that say I like cats, and I like dogs will be selected. Apply the same principal to your actual work and there you have it i have benefit from your post today thank you very much ... Quote
jr.roberto.santos Posted June 22, 2022 Posted June 22, 2022 Hello everyone. this code is very good. I would like to select the text regardless of whether it is uppercase or lowercase. it is possible? search example: Low@@@@@E / LOWER@@@E / lower@@@@ / *lower* / LOWERC* / Lower* etc Best regards Quote
mhupp Posted June 26, 2022 Posted June 26, 2022 This will find any text or mtext that contains what you input regardless of capitalization and then select/highlight it. ;;----------------------------------------------------------------------------;; ;; Find and Select Text (defun C:FTXT (/ str SS) (setq str (strcat "*" (getstring "\nPattern to find: ") "*")) (if (setq SS (ssget "_X" (list (cons 0 "*TEXT") (cons 1 str) (cons 410 (getvar 'ctab))))) (prompt (strcat (itoa (sslength ss)) " items found")) ) (sssetfirst nil SS) (princ) ) Quote
jr.roberto.santos Posted June 26, 2022 Posted June 26, 2022 @mhupp Thanks for the reply. I tried to use the code but it didn't work. Quote
BIGAL Posted June 26, 2022 Posted June 26, 2022 Hmmm ok for me (sslength (ssget "_X" (list (cons 0 "*TEXT") (cons 1 "*case*") (cons 410 (getvar 'ctab))))) 5 Quote
Steven P Posted June 27, 2022 Posted June 27, 2022 Just had a quick check, didn't work here either, and was case sensitive 1 Quote
mhupp Posted June 27, 2022 Posted June 27, 2022 (edited) Looks like BricsCAD searches text without case sensitivity or it might be a variable BIGAL and myself have turned on IDK. This will convert everything to uppercase with strcase (for matching with wcmatch) so case sensitivity doesn't matter. ;;----------------------------------------------------------------------------;; ;; Find and Select Text (defun C:FTXT (/ ss ss1 str) (setq ss1 (ssadd)) (setq str (strcat "*" (strcase (getstring "\nPattern to find: ")) "*")) (if (setq ss (ssget "_X" (list '(0 . "*TEXT") (cons 410 (getvar 'ctab))))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq obj (vlax-ename->vla-object ent)) (if (wcmatch (strcase (vla-get-TextString obj)) str) (setq ss1 (ssadd ent ss1)) ) ) ) (prompt (strcat (itoa (sslength ss1)) " items found")) (sssetfirst nil ss1) (princ) ) Edited June 27, 2022 by mhupp Code Updated 1 Quote
jr.roberto.santos Posted June 27, 2022 Posted June 27, 2022 @mhupp Perfect, I just changed the variable ss to ss1 (sssetfirst nil ss1) Best regards 1 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.