that was quick Mark!!
creates a .csv file on the root of C named the same as the dwg.
example: Drawing1.csv
(defun c:layers2csv (/ get->layobj open->file lay lylst fo)
(vl-load-com)
(defun get->layrobj ()
(vla-get-Layers
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
)
(vlax-for lay (get->layrobj)
(setq lylst
(cons
(list
(vlax-get-property lay 'Name)
(itoa (vlax-get-property lay 'Color))
(vlax-get-property lay 'Linetype)
)
lylst
)
)
)
(if lylst
(progn
; remove layer '0' and reverse the list
(setq lylst (reverse (vl-remove (last lylst) lylst))
; sort the list
lylst (vl-sort lylst '(lambda (x y) (< (car x)(car y))))
fo (open (strcat "c:/"(getvar 'dwgname)".csv") "w"); suitable for Excel
)
(foreach l lylst
(write-line (strcat (car l) "," (cadr l) "," (last l)) fo)
)
(close fo)
)
)
(princ)
)