本帖最后由 wmz 于 2014-10-18 21:22 编辑
- (defun c:tt()
- (setq f (open "D:/test.txt" "w"))
- (setq s (ssget))
- (setq n (sslength s) m 0 pp '())
- (repeat n
- (setq e (ssname s m) m (1+ m))
- (setq e1 (entget e))
- (setq e2 (cdr(assoc 0 e1)))
- (if (= e2 "CIRCLE")
- (progn
- (setq pt (cdr (assoc 10 e1)))
- (setq pp (cons pt pp))
- )
- )
- )
- (setq pp (vl-sort pp
- (function (lambda (a b)
- (if (= (car a) (car b))
- (<= (car a) (car b))
- (> (cadr a) (cadr b))
- )
- )
- )
- )
- )
- (setq m 0)
- (repeat (length pp)
- (setq p (nth m pp) m (1+ m))
- (setq y (car p) x (cadr p))
- (setq b (strcat (rtos m 2 0) "," (rtos y 2 2) "," (rtos x 2 2)))
- (write-line b f)
- )
- (close f)
- (princ)
- )
|