tuerlinckx_peter862162
2013-02-12, 03:40 PM
Dear all,
I am trying to find a way to change the color of Xref layers. Based on the original color of the layer in the original drawing.
But this is giving me some troubles. At the moment i think i understand how i can cycle through the entire layer list. However i don't understand how the lisp can make the difference in layer colors and such...
Is there anyone who is willing to help me upgragde my code a bit?
So far i came up with:
(vl-load-com)
(defun C:TEBXFADE ()
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(setq i 0)
(repeat (vla-get-count theLayers)
(setq aLayer (vla-item theLayers i))
(cond ((and (= vla-get-color 1) (= vla-get-name "*|*"))
(vla-put-color alayer 251))
((and (= vla-get-color 2) (= vla-get-name "*|*"))
(vla-put-color alayer 9))
((and (= vla-get-color 3) (= vla-get-name "*|*"))
(vla-put-color alayer 8))
((and (= vla-get-color 4) (= vla-get-name "*|*"))
(vla-put-color alayer 8))
((and (= vla-get-color 5) (= vla-get-name "*|*"))
(vla-put-color alayer 8))
((and (= vla-get-color 7) (= vla-get-name "*|*"))
(vla-put-color alayer 251))
((and (= vla-get-color 8) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 9) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 250) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 251) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 253) (= vla-get-name "*|*"))
(vla-put-color alayer 254))
(T (princ "\nNo Xref layers found"))
(setq i (1+ i))
);cond
);repeat
);defun
I am trying to find a way to change the color of Xref layers. Based on the original color of the layer in the original drawing.
But this is giving me some troubles. At the moment i think i understand how i can cycle through the entire layer list. However i don't understand how the lisp can make the difference in layer colors and such...
Is there anyone who is willing to help me upgragde my code a bit?
So far i came up with:
(vl-load-com)
(defun C:TEBXFADE ()
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(setq i 0)
(repeat (vla-get-count theLayers)
(setq aLayer (vla-item theLayers i))
(cond ((and (= vla-get-color 1) (= vla-get-name "*|*"))
(vla-put-color alayer 251))
((and (= vla-get-color 2) (= vla-get-name "*|*"))
(vla-put-color alayer 9))
((and (= vla-get-color 3) (= vla-get-name "*|*"))
(vla-put-color alayer 8))
((and (= vla-get-color 4) (= vla-get-name "*|*"))
(vla-put-color alayer 8))
((and (= vla-get-color 5) (= vla-get-name "*|*"))
(vla-put-color alayer 8))
((and (= vla-get-color 7) (= vla-get-name "*|*"))
(vla-put-color alayer 251))
((and (= vla-get-color 8) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 9) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 250) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 251) (= vla-get-name "*|*"))
(vla-put-color alayer 252))
((and (= vla-get-color 253) (= vla-get-name "*|*"))
(vla-put-color alayer 254))
(T (princ "\nNo Xref layers found"))
(setq i (1+ i))
);cond
);repeat
);defun