本帖最后由 作者 于 2009-2-9 10:33:23 编辑
;;已经修改,只是 acad_strlsort 会把 A3 排在 A11后面 (defun C:TT (/ SS I STR I REL LST X RLST ILST) (if (setq SS (ssget '((0 . "TEXT") (1 . "@#*")))) (progn (repeat (setq I (sslength SS)) (setq STR (cdr (assoc 1 (entget (ssname SS (setq I (1- I))))))) (if (setq REL (distof (substr str 2))) (setq LST (cons STR LST)) ) ) (setq LST (acad_strlsort LST)) (while (setq X (car LST)) (setq LEN (length LST) LST (vl-remove X LST) RLST (append RLST (list (cons X (- LEN (length LST))))) ) ) ) ) ) |