本帖最后由 xyp1964 于 2019-1-29 13:38 编辑
- (defun c:tt (/ lst)
- (setq ukw (Ukword 1 "1 2" "1-先上下后左右/2-先左右后上下" ukw)) (princ "\n请选择要排序的实体...")
- (if (setq ss (ssget '((0 . "circle"))))
- (progn
- (setq i 0)
- (repeat (sslength ss)
- (setq pt (cdr (assoc 10 (entget (ssname ss i))))
- lst (cons pt lst)
- i (1+ i)
- )
- )
- (setq lst (if (= ukw "1")
- (vl-sort lst '(lambda (x y) (if (equal (cadr x) (cadr y) 1e-3) (< (car x) (car y))(> (cadr x) (cadr y)))))
- (vl-sort lst '(lambda (x y)(if (equal (car x) (car y) 1e-3)(> (cadr x) (cadr y))(< (car x) (car y))))))
- i 0
- )
- (mapcar '(lambda (x)
- (setq i (1+ i) bh (itoa i))
- (command "text" "j" "mc" "non" x 25 0 bh)
- )
- lst
- )
- )
- )
- (princ)
- )
|