(defun c:ChangeLayerLineweight (/ ActDoc LayCol LayColor)
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
^ Gets the currecnt drawing (document)
(setq LayCol (vla-get-Layers ActDoc))
^ Gets the layer collection, all the layers in the drawing
(vlax-for Lay LayCol
^ This is like foreach, but for collections
(setq LayColor (vla-get-Color Lay))
^ Gets the color of the layer
(cond
((= LayColor 1)
^ If the color of the layer (variable LayColor) equals 1 (red)
then do what is below.
(vla-put-Lineweight Lay acLnWt025)
^ Puts the lineweight 0.25 to the layer
)
With the cond statement, the first items that is returned true gets done, then it exits the cond statement. So here we are testing to find what color the layer is, assign a lineweight per that color, then moving on to the next layer.
Hope that makes it a little clearer.
Tim