Jump to content

Recommended Posts

Posted

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))

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • leos98

    11

  • Lee Mac

    9

  • mjb

    3

  • GE13579

    2

Top Posters In This Topic

Posted

Lee Mac,

 

Thanks a lot, it works perfect, just what I was looking for.

:thumbsup:

 

Thanks!

Posted
Lee Mac,

 

Thanks a lot, it works perfect, just what I was looking for.

:thumbsup:

 

Thanks!

 

Glad it meets your requirements - any other questions, just ask :)

  • 1 month later...
Posted

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.

Posted

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))

Posted

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.

Posted

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 :)

Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...