TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: well20152016 on September 23, 2017, 12:02:03 AM

Title: Continuous selection entity inside block, then select the entity change color
Post by: well20152016 on September 23, 2017, 12:02:03 AM
Continuous selection  entity inside block,  then select the entity change color

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt (/ lst ss)
  2. (setq ss (ssadd))
  3. (while (setq Ent (nentsel "\nPick an  entity inside the block: "))
  4.        (setq lst (cons ent lst) ss (ssadd (car ent) ss))
  5.        (sssetfirst nil ss)
  6.   )
  7. (foreach a lst
  8.   (vla-put-Color (vlax-ename->vla-object (car a)) 6)
  9.   )
  10. )


EDIT (John): Added code tags for better display.
Title: Re: Continuous selection entity inside block, then select the entity change color
Post by: Lee Mac on September 23, 2017, 07:22:43 AM
Is there a question here?
Title: Re: Continuous selection entity inside block, then select the entity change color
Post by: well20152016 on September 23, 2017, 08:59:14 AM
My lisp, I don't know what's wrong!
Title: Re: Continuous selection entity inside block, then select the entity change color
Post by: ribarm on September 23, 2017, 01:02:21 PM
AFAIK, you can't highlight nested entities... You could though try changing color and transparency...
Something like this :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ( / adoc ent lst )
  2.  
  3.  
  4.   (while (setq ent (car (nentsel "\nPick an entity inside the block: ")))
  5.     (setq lst (cons (list ent (vla-get-entitytransparency (vlax-ename->vla-object ent))) lst))
  6.     (foreach a lst
  7.       (vla-put-color (vlax-ename->vla-object (car a)) 1)
  8.       (vla-put-entitytransparency (vlax-ename->vla-object (car a)) 75)
  9.     )
  10.     (vla-regen adoc :vlax-true)
  11.   )
  12.   (foreach a lst
  13.     (vla-put-color (vlax-ename->vla-object (car a)) 6)
  14.     (vla-put-entitytransparency (vlax-ename->vla-object (car a)) (cadr a))
  15.   )
  16.   (vla-regen adoc :vlax-true)
  17.   (princ)
  18. )
  19.  

Cheers...
 :thinking:
Title: Re: Continuous selection entity inside block, then select the entity change color
Post by: well20152016 on September 23, 2017, 07:14:33 PM
Thank you, ribarm, Lee, Mac!
I wonder if it can be implemented with ssget?
Title: Re: Continuous selection entity inside block, then select the entity change color
Post by: Lee Mac on September 23, 2017, 07:32:09 PM
I wonder if it can be implemented with ssget?

I recall that Tim tried this a long time ago - see here (http://bit.ly/14FKa3h).