Lee Mac Posted April 3, 2009 Posted April 3, 2009 Ahh, sorry, forgot to mention - with this new code, for individual colours, you will need to format like this: (defun c:laycol1 (/ colLst lay col) (vl-load-com) (setq colLst '( ((10 19) 15) ;; <<---<< Edit this as necessary ((20 29) 25) ((30 39) 35) ((40 49) 45) ((50 59) 55) ((60 69) 65) ((70 79) 75) ((80 89) 85) ((90 99) 95) ((100 109) 105) ((110 119) 115) ((120 129) 125) ((130 139) 135) ((140 149) 145) ((150 159) 155) ((160 169) 165) ((170 179) 175) ((180 189) 185) ((190 199) 195) ((200 209) 205) ((210 219) 215) ((220 229) 225) ((230 239) 235) ((240 249) 245) ((1 1) 15) ((2 2) 55) ((3 3) 95) ((4 4) 135) ((5 5) 175) ((6 6) 215) ((7 7) 9) )) (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (setq lay (cons l lay))) (foreach layer lay (foreach col colLst (if (<= (caar col) (vla-get-color layer) (cadar col)) (vla-put-color layer (cadr col))))) (princ)) Quote
leos98 Posted April 3, 2009 Author Posted April 3, 2009 Lee Mac, Thanks a lot, it works perfect, just what I was looking for. Thanks! Quote
Lee Mac Posted April 3, 2009 Posted April 3, 2009 Lee Mac, Thanks a lot, it works perfect, just what I was looking for. Thanks! Glad it meets your requirements - any other questions, just ask Quote
mjb Posted May 15, 2009 Posted May 15, 2009 Hey I saw this lisp code and this is exactly what I need for red line plans that I am doing. I tested this and it works great but it changes ever layer color. If you can, could you please tell me what additional Lisp code I would need so that only the layer colors of an XREF would be changed and not to the whole drawing? Thanks. Quote
Lee Mac Posted May 15, 2009 Posted May 15, 2009 Try this: (defun c:laycol1 (/ colLst lay col) (vl-load-com) (setq colLst '( ((10 19) 15) ;; <<---<< Edit this as necessary ((20 29) 25) ((30 39) 35) ((40 49) 45) ((50 59) 55) ((60 69) 65) ((70 79) 75) ((80 89) 85) ((90 99) 95) ((100 109) 105) ((110 119) 115) ((120 129) 125) ((130 139) 135) ((140 149) 145) ((150 159) 155) ((160 169) 165) ((170 179) 175) ((180 189) 185) ((190 199) 195) ((200 209) 205) ((210 219) 215) ((220 229) 225) ((230 239) 235) ((240 249) 245) ((1 1) 15) ((2 2) 55) ((3 3) 95) ((4 4) 135) ((5 5) 175) ((6 6) 215) ((7 7) 9) )) (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (setq lay (cons l lay))) (foreach layer lay (if (vl-string-position 124 (vla-get-Name layer)) (foreach col colLst (if (<= (caar col) (vla-get-color layer) (cadar col)) (vla-put-color layer (cadr col)))))) (princ)) Quote
mjb Posted May 15, 2009 Posted May 15, 2009 I tried this but it is still changing every layer color in my drawing. Let me try to explain more in detail what I need. I have a drawing that has several binded xrefs as blocks and there is only one xref attached in the drawing. I want the lisp routine to only change the layer colors of that xref that is attached but leave all the other layer colors in the drawing as is. Quote
mjb Posted May 15, 2009 Posted May 15, 2009 Hey I finally figured it out. I had to exit out of my drawing then go back in and reload the routine. Then it worked. As you can probably tell I am not much on programing. The modified Lisp routine you sent me works out great and save me a lot of CAD time. Thanks Quote
Lee Mac Posted May 15, 2009 Posted May 15, 2009 Hey I finally figured it out. I had to exit out of my drawing then go back in and reload the routine. Then it worked. As you can probably tell I am not much on programing. The modified Lisp routine you sent me works out great and save me a lot of CAD time. Thanks No problem Just as a heads-up, whenever you are trying two routines that have the same syntax, you will have to either reload the drawing or the routine Lee Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.