Message 1 of 4

Not applicable
04-23-2017
06:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi folks,
I need to search for all instances of "xx" , "xxx" and "xxxx" in multiple drawings and change their colors to "255,0,0". I am using follwing code which works fine for *text and *leaders but I want to do the same for attributes as well (I have certain blocks with attributes whose values may contain "xx" , etc.). Can anyone help me with adding that bit to the code? I mean I want to search for attribute values. If it contains the value of "xx" or whatever, then change that certain attribute's text color to "255,0,0".
Thanks
(defun foo (text / ss) (sssetfirst nil (setq ss (ssget "_x" (list '(-4 . "<OR") '(-4 . "<AND") '(0 . "*TEXT") (cons 1 (setq text(strcat "*" (strcase text) "*,*" (strcase text T) "*"))) '(-4 . "AND>") '(-4 . "<AND") '(0 . "MULTILEADER") (cons 304 text) '(-4 . "AND>") '(-4 . "OR>") ) ) ) ) ss ) (if (setq ss (foo "xx")) ;;Searching for "xx" (command ".CHPROP" ss "" "Color" "Truecolor" "255,0,0" "") ) (if (setq ss (foo "xxx")) ;;Searching for "xxx" (command ".CHPROP" ss "" "Color" "Truecolor" "255,0,0" "") ) (if (setq ss (foo "xxxx")) ;;Searching for "xxxx" (command ".CHPROP" ss "" "Color" "Truecolor" "255,0,0" "") )
Solved! Go to Solution.