The count column is superfluous as each block will have different x, y and z coordinates.
Try this:
(vl-load-com)
(defun c:test (/ *error* c_doc ss blk_name b_lst)
(defun *error* ( msg )
(if fp (close fp))
(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nAn Error : " msg " occurred.")))
(princ)
);end_*error*_defun
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
csv_file (strcat (getvar "dwgprefix") (getvar "dwgname") " - Block Data" ".csv");construct csv file name
fp (open csv_file "w");open csv file
ss (ssget "_X" '((0 . "INSERT")))
);end_setq
(write-line "Block Name, Rotation, Layer , X , Y , Z" fp)
(vlax-for blk (vla-get-activeselectionset c_doc)
(setq blk_name (vlax-get-property blk (if (vlax-property-available-p blk 'effectivename) 'effectivename 'name))
b_lst (cons (list blk_name (vlax-get-property blk 'rotation) (vlax-get-property blk 'layer) (vlax-get blk 'insertionpoint)) b_lst)
);end_setq
);end_for
(setq s_lst (vl-sort b_lst '(lambda (x y) (if (= (car x) (car y)) (< (cadr x) (cadr y)) (< (car x) (car y))))))
(foreach blk s_lst
(write-line (strcat (nth 0 blk) "," (angtos (nth 1 blk) 0 0) "," (nth 2 blk) "," (rtos (car (nth 3 blk)) 2 3) "," (rtos (cadr (nth 3 blk)) 2 3) "," (rtos (caddr (nth 3 blk)) 2 3)) fp)
);end_foreach
(close fp);close file
(princ)
);end_defun
It writes the results into a csv file which can be opened in excel. It is placed in the same directory as the drawing.
I am not one of the robots you're looking for