erase all text with exception of color 'bylayer'

erase all text with exception of color 'bylayer'

larsr2866
Enthusiast Enthusiast
377 Views
4 Replies
Message 1 of 5

erase all text with exception of color 'bylayer'

larsr2866
Enthusiast
Enthusiast

Hello,

 

I'm trying to make a lisp to erase all text wich color isn't bylayer, but it doesn't seem to work.

Can someone help me with this?

 

Thanks in advance!

 

(command
"_.erase"
(ssget "_X" '((0 . "TEXT,MTEXT") (-4 . "<not")(cons 62. "256")(-4 . "not>")))

)
(if (> (getvar 'cmdactive) 0)

(command "")

)

0 Likes
Accepted solutions (1)
378 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

A couple of problems* -- try this in place of that one line:

(ssget "_X" '((0 . "*TEXT") (-4 . "<NOT") (62 . 256) (-4 . "NOT>")))

 

And I would simplify the completion of the Erase command -- no need to end the (command) function it's in and then check whether it's still running to give it a concluding Enter "":

(command
  "_.erase"
  (ssget "_X" '((0 . "*TEXT") (-4 . "<NOT") (62 . 256) (-4 . "NOT>")))

  ""

)

 

* Problems:  In a "quoted" list [the apostrophe], you can't include a (cons) function that requires evaluation.  If used in a non-quoted (list) function where that would be allowed, the period after the 62 can't be there, and the 256 can't be in quotes.

Kent Cooper, AIA
0 Likes
Message 3 of 5

larsr2866
Enthusiast
Enthusiast

Thanks! That worked perfect! 🙂

0 Likes
Message 4 of 5

Moshe-A
Mentor
Mentor

@larsr2866 

 

 or this,  selects all objects that are not BYLAYER

 

(setq ss (ssget "_x" '((-4 . "<>") (62 . 255))))

 

Moshe

 

0 Likes
Message 5 of 5

Kent1Cooper
Consultant
Consultant

@Moshe-A wrote:

... selects all objects that are not BYLAYER

(setq ss (ssget "_x" '((-4 . "<>") (62 . 255))))

....


True, if with 256.

Kent Cooper, AIA
0 Likes