Lisp to Change Color of all layers a little lighter

Lisp to Change Color of all layers a little lighter

Anonymous
Not applicable
2,179 Views
6 Replies
Message 1 of 7

Lisp to Change Color of all layers a little lighter

Anonymous
Not applicable

Mornin' all!!!

 

I'm looking for a lisp that will change all my layer colors by 1, basically change the shade of every layer a little lighter.

Any assistance would be grand!

0 Likes
Accepted solutions (1)
2,180 Views
6 Replies
Replies (6)
Message 2 of 7

Edwin.Saez
Advisor
Advisor

here!

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/a-lisp-to-make-all-entities-color-qu...

Edwin Saez


LinkedIn / AutoCAD Certified Professional


EESignature


 


Si mi respuesta fue una solución para usted, por favor seleccione "Aceptar Solución", para que también sirva a otro usuarios.

0 Likes
Message 3 of 7

Anonymous
Not applicable

this lisp changed all entities to the same color, i'm looking tfor each entity to go one shade lighter or one number lighter than the existing color ie.. 132 to 131. id like the layer to change not the entity also

0 Likes
Message 4 of 7

Ranjit_Singh
Advisor
Advisor

Try below. This changes all the layers by dropping one unit from R,G and B colors.

;:Ranjit Singh
;;8/16/17
(defun c:somefunc  (/ colobj)
 (setq colobj (vla-getinterfaceobject (vlax-get-acad-object)
                                      (strcat "autocad.accmcolor." (itoa (atoi (getvar 'acadver))))))
 (vlax-for lay  (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
  (apply 'vla-setrgb
         (cons colobj
               (mapcar '(lambda (x)
                         (if (zerop x)
                          x
                          (1- x)))
                       (mapcar '(lambda (x) (vlax-get (vla-get-truecolor lay) x)) '(red green blue)))))
  (vla-put-truecolor lay colobj)))

Drop_RGB.gif

 

Message 5 of 7

Anonymous
Not applicable

is here any way i can just change the ACI color up or down 1

0 Likes
Message 6 of 7

Ranjit_Singh
Advisor
Advisor
Accepted solution

Maybe like this

;;Ranjit Singh
;; 8/16/17
(defun c:somefunc  (/ latcol newind)
 (vlax-for lay  (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
  (setq latcol (vla-get-truecolor lay))
  (if (= 195 (vla-get-colormethod latcol))
   (vl-catch-all-apply 'vla-put-color
                       (list lay
                             (if (zerop (setq newind (1- (vla-get-colorindex latcol))))
                              0
                              newind))))))

Drop_Index.gif

 

Message 7 of 7

Anonymous
Not applicable

Thank you so much this is perfect!!!! Have a grand day!

0 Likes