;Modified by Igal Averbuh 2015
;Improved by Ken Bast 2015 E-mail: Kenneth.s.bast@ca.abb.com

(defun c:IBC (/ ctyp *layers)
(layerstate-save "before-color-isolate" nil nil)
(alert "\n Select layer color to isolate: ")
(setq ctyp (acad_colordlg 1))
(setq *layers (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
(vlax-for item *layers
(if (/= (GetX (GetX item 'TrueColor) 'ColorIndex) ctyp)
(PutX item 'LayerOn 0)

(defun GetX (object prop)
(if (vlax-property-available-p object prop)
(vlax-get object prop)

(defun PutX (object prop val)
(if (vlax-property-available-p object prop T)
(vlax-put object prop val)
(alert "\n To restore previous condition type RP ")

(defun c:rp ()
(layerstate-restore "before-color-isolate" nil nil)