;;;Finds matching text strings in text, mtext, and multileaders (DEFUN C:GETSTR (/ str-ss entremlst) (IF ustr nil (LOAD "ustr" "\nFile USTR.LSP not loaded! ") ) ;_ end of IF (SETQ str2get (ustr 1 "Enter text string to search for (include wildcards)" str2get T)) (IF (AND str2get (EQ (TYPE str2get) 'STR)) (SETQ str-ss (SSGET "X" (LIST (CONS -4 "") (CONS 304 str2get);multileader text string (CONS 0 "MTEXT");Must examine all MTEXT or risk a truncated (ASSOC 3 ) value (CONS -4 "OR>") ) ;_ end of LIST ) ;_ end of SSGET ) ;_ end of SETQ ) ;_ end of IF (IF str-ss (PROGN (SETQ cnt 0) (WHILE (< cnt (SSLENGTH str-ss)) (IF (EQ (CDR (ASSOC 0 (ENTGET (SSNAME str-ss cnt)))) "MTEXT");Must examine all MTEXT or risk a truncated (ASSOC 3 ) value (PROGN (SETQ this-obj (VLAX-ENAME->VLA-OBJECT (CDR (ASSOC -1 (ENTGET (SSNAME str-ss cnt)))))) (SETQ this-str (VLAX-GET-PROPERTY this-obj 'TextString)) (IF (WCMATCH this-str str2get) NIL (SETQ entremlst (APPEND entremlst (LIST (CDR (ASSOC -1 (ENTGET (SSNAME str-ss cnt))))))) ;If the full MTEXT string does not match then remove the entity from the selection set ) ;_ end of IF ) ;_ end of PROGN ) ;_ end of IF (SETQ cnt (1+ cnt)) ) ;_ end of WHILE (IF entremlst (FOREACH n entremlst (SSDEL n str-ss)) ) ;_ end of IF (IF (> (SSLENGTH str-ss) 0) (PROGN (PRINC "\n") (PRINC (STRCAT (ITOA (SSLENGTH str-ss)) " object" (IF (> (SSLENGTH str-ss) 1) "s" "" ) ;_ end of IF " found containing at least one matching string.\n" ) ;_ end of STRCAT ) ;_ end of PRINC (PRINC "\n********** Matching String List ********** ") (PRINC) (SETQ cnt 0 str-cnt 0 ) ;_ end of SETQ (WHILE (< cnt (SSLENGTH str-ss)) (SETQ this-ent (ENTGET (SSNAME str-ss cnt))) (COND ((EQ (CDR (ASSOC 0 this-ent)) "MTEXT") (SETQ this-obj (VLAX-ENAME->VLA-OBJECT (CDR (ASSOC -1 this-ent)))) (SETQ this-str (VLAX-GET-PROPERTY this-obj 'TextString)) (PRINC (STRCAT "\n" (ITOA (SETQ str-cnt (1+ str-cnt))) ".\t")) (PRINC this-str) (PRINC) ) ((AND (ASSOC 1 this-ent) (WCMATCH (CDR (ASSOC 1 this-ent)) str2get)) (PRINC (STRCAT "\n" (ITOA (SETQ str-cnt (1+ str-cnt))) ".\t")) (PRINC (CDR (ASSOC 1 this-ent))) (PRINC) ) ((AND (ASSOC 304 this-ent) (WCMATCH (CDR (ASSOC 304 this-ent)) str2get)) (PRINC (STRCAT "\n" (ITOA (SETQ str-cnt (1+ str-cnt))) ".\t")) (PRINC (CDR (ASSOC 304 this-ent))) (PRINC) ) ) ;_ end of COND (SETQ cnt (1+ cnt)) ) ;_ end of WHILE (PRINC (STRCAT "\n\n" (ITOA str-cnt) " matching string" (IF (> str-cnt 1) "s" "" ) ;_ end of IF " found! Use'previous' to select matching text. " ) ;_ end of STRCAT ) ;_ end of PRINC ) ;_ end of PROGN (PRINC (STRCAT "\nNo selection found matching " str2get)) ) ;_ end of IF ) ;_ end of PROGN (PRINC (STRCAT "\nNo selection found matching " str2get)) ) ;_ end of IF (PRINC) ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 0 nil nil nil T T) ;*** DO NOT add text below the comment! ***|;