Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select text by style name

5 REPLIES 5
Reply
Message 1 of 6
kemp77
414 Views, 5 Replies

Select text by style name

I need to find a way to modify text based on the current style name wihtout having to select anything on screen. To do this I want to run a simple filter, but my knowledge of how filters work is pretty lacking. I tried using something like this:

(ssget "_X" '(0 . "STYLE")(7 . "Reg"))

But clearly I am all mixed up on how these dotted pairs should be formatted because I just get a bad syntax error when I try it. Can anyone lead me in the right direction? Maybe there is a more efficient VLA method that would do the job.... Hmm...
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: kemp77

Try (ssget "X" '((0 . "TEXT") (7 . "REG"))). Assuming REG is the name of the style of your text.
Message 3 of 6
Anonymous
in reply to: kemp77

On 5/11/2010 6:21 PM, kemp77 wrote:
> I need to find a way to modify text based on the current style name wihtout having to select anything on screen. To do this I want to run a simple filter, but my knowledge of how filters work is pretty lacking. I tried using something like this:
>
> (ssget "_X" '(0 . "STYLE")(7 . "Reg"))
>
> But clearly I am all mixed up on how these dotted pairs should be formatted because I just get a bad syntax error when I try it. Can anyone lead me in the right direction? Maybe there is a more efficient VLA method that would do the job.... Hmm...

The attached lsp routine will change any style to a style of the user's
choice.
Message 4 of 6
Kent1Cooper
in reply to: kemp77

It is very likely not necessary to filter for the Text entity type. That could probably be reduced to

(ssget "X" '((7 . "REG")))

unless there might be other kinds of drawing entities that could have 7-code entries with "REG" in their entity data, but that doesn't seem likely except for Mtext as well as Text. If you want to catch both kinds, you can do it as above, or adjust azrdgldr's suggestion to

(ssget "X" '((0 . "*TEXT") (7 . "REG")))

with a * before the TEXT word. If you only want to catch Text, but *not* Mtext, use azrdgldr's suggestion as is.

--
Kent Cooper


azrdgldr wrote...
Try (ssget "X" '((0 . "TEXT") (7 . "REG"))). Assuming REG is the name of the style of your text.
Kent Cooper, AIA
Message 5 of 6
Anonymous
in reply to: kemp77

Thanks Kent, I had totally forgotten about the mtext possibility, even though the OP just stated text.
Message 6 of 6
kemp77
in reply to: kemp77

Thanks guys. This discussion actually helped me to understand how the filter works a lot better. It's much simpler than my brain was trying to make it! Par for the course...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost