Dorian Gray Posted March 1, 2010 Posted March 1, 2010 Does anyone know how I can select specific text, such as text that beings with bw and change to a layer..... I was having a look at the object selection filter and qselect but can't seem to get anywhere. SSX doesn't have anything either.... Cheers Quote
lpseifert Posted March 1, 2010 Posted March 1, 2010 this worked the few times I tried it, not a whole lot of error control... (defun c:test (/ pre prelen ln ss idx cnt obj) (vl-load-com) (setq pre (getstring "\nEnter prefix (case sensitive):") prelen (strlen pre) ln (getstring "\nEnter Layer name: ") ) (if (not (tblsearch "layer" ln)) (princ "\nLayer does not exist") (progn (setq ss (ssget "X" '((0 . "*TEXT"))) idx 0 cnt 0) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname ss idx)) ) (if (= pre (substr (vlax-get obj 'Textstring) 1 prelen)) (progn (vlax-put obj 'Layer ln) (setq cnt (1+ cnt)) ) ) (setq idx (1+ idx)) ) (princ (strcat "\n" (itoa cnt) " text entities moved to layer " ln)) ) ) (princ) ) ====================== Why use lisp when Acad has the ability built in... use Geobuilder's suggestion below Quote
BearDyugin Posted March 1, 2010 Posted March 1, 2010 quick select -> Properties [Contents] -> The operator [* search with global symbols] -> Value [bw*] -> Ok )Translation can be not exact, look on sense) Quote
Dorian Gray Posted March 1, 2010 Author Posted March 1, 2010 How does that lsp routine work am i required to alter anything....I tried entering but it didn't work, can you explain a little better??? And the quick select doesn't work either, I'm using 2010 - this is what I selected Apply to: entire drawing Object type: Mtext Properties: Contents Operator: * Value: BW* Command line: Command: _.QSELECT 0 item(s) selected. Quote
lpseifert Posted March 1, 2010 Posted March 1, 2010 Q1. Look here http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F Qselect works... it's case sensitive if the text in the drawing starts with bw and you enter BW* as the Value, nothing will be selected. or... maybe it's not Mtext, try Text as the Object type 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.