Change layer VPcolor

Change layer VPcolor

jbear0000
Enthusiast Enthusiast
762 Views
3 Replies
Message 1 of 4

Change layer VPcolor

jbear0000
Enthusiast
Enthusiast

My company uses the attached lisp file to automatically screen back all layers that are turned on and that are set to the colors in the attached screen.txt file. The lisp changes the layer globally. What would I need to change about this lisp to make it just change the layers in whatever viewport is active? Maybe that isn't even possible, but if it is a simple change to this lisp then I'd appreciate the help.

 

 

0 Likes
Accepted solutions (1)
763 Views
3 Replies
Replies (3)
Message 2 of 4

pbejse
Mentor
Mentor
Accepted solution

@jbear0000 wrote:

My company uses the attached lisp file to automatically screen back all layers that are turned on and that are set to the colors in the attached screen.txt file.


Would you settle for selecting a viewport ?

 

(Defun _XrefColorMatch (l / a lst)
  (while (setq a (tblnext "Layer" (null a)))
    (if	(and
	  (wcmatch (setq xln (cdr (assoc 2 a))) "*|*")
	  (setq xlc (assoc (cdr (assoc 62 a)) l))
	  )
      (setq
	lst (cons (list xlc xln) lst)
      )
    )
  )lst
)
(defun c:colorscreensel ( / clrset avp)
  (setvar "CMDECHO" 0)
  (setq clrset (COLOR_SET))
  (setq xrcdata (_XrefColorMatch clrset))
  (if (and
	(zerop (getvar 'Tilemode))
	(setq avp (ssget "_+.:E:S" '((0 . "VIEWPORT"))))
	(setq avp (ssname avp 0)))
    (progn
	  (command "vpLAYER")
		(While (setq vpl (car xrcdata))
		  (prompt (strcat "\nLayer [" (cadr vpl) "] from color "
	           (itoa (caar vpl))  " to new color " (itoa (cadar vpl)))
	             )
		  (command "_Color" (cadar vpl) (cadr vpl) "_Select" avp "")
		  (setq xrcdata (cdr xrcdata))
	        )
	(command "") 
      )
   )(princ)
)

 

command: colorscreensel 

 

You still need the COLOR_SET subfunction

 

HTH

Message 3 of 4

jbear0000
Enthusiast
Enthusiast

Thank you! That is perfect!

 

0 Likes
Message 4 of 4

pbejse
Mentor
Mentor

@jbear0000 wrote:

Thank you! That is perfect!

 


Good for you@jbear0000, You are welcome