Jump to content

Selecting specific text


Recommended Posts

Posted

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

Posted

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

Posted

quick select -> Properties [Contents] -> The operator [* search with global symbols] -> Value [bw*] -> Ok )Translation can be not exact, look on sense)

0007972b273c.gif

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...