;(setq fo (open (setq fname "C:\\yourdiredctory\\yourfilename.csv") "w"))
;(write-line "Rank,Length,Type" fo)
;(repeat (setq x (length lst))
;(setq ans (nth (setq x (- x 1)) lst))
;(write-line (strcat (rtos y 2 0) "," (car ans) "," (rtos (cadr ans) 2 2)) fo)
;(setq y (+ y 1))
;)
;(close fo)
@BIGAL just notice you have commented ";" in your code , that's why it doesn't write file
here's another quick & dirty using vlax-curve- function
(defun c:CA (/ *error* l ls f fn i ss fn)
(defun *error* (msg)
(if (= (type f) 'FILE)
(close f)
)
(terpri)
)
(if (and (setq i 0
ss (ssget "_X" (list '(0 . "ARC,CIRCLE") (cons 410 (getvar 'CTAB))))
)
(setq ls (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))));(acet-ss-to-list ss))
(setq fn (vl-filename-mktemp "CA.csv"))
(setq f (open fn "W"))
(write-line "Rank,Length,Type" f)
)
(progn (setq i 0
l (mapcar ''((x)
(list (vlax-curve-getDistAtParam x (vlax-curve-getEndParam x)) (cdr (assoc 0 (entget x))))
)
ls
)
ls (vl-sort l ''((a b) (< (car a) (car b))))
)
(foreach x ls
(write-line
(apply 'strcat
(mapcar ''((x) (strcat x ",")) (list (itoa (setq i (1+ i))) (rtos (car x) 2) (cadr x)))
)
f
)
)
(if (= (type f) 'FILE)
(close f)
)
(vl-cmdf "_START" fn)
)
(princ "\nOops.. Nothing?")
)
(princ)
)