快速写下这篇文章-可能就是你想要的:
- (defun c:reNum (/ dCars tmpVars ss att)
- (setq dVars '(sNum inNum Pref Suff))
- (mapcar '(lambda (x y) (or (boundp x) (set x y))) dVars '(1 1 "" ""))
- (setq tmpVars (list (getreal (strcat "\nSpecify Starting Number <" (rtos sNum 2 2) ">: "))
- (getreal (strcat "\nSpecify Increment <" (rtos inNum 2 2) ">: "))
- (getstring t (strcat "\nSpecify Prefix <" (if (eq "" Pref) "-None-" Pref) ">: "))
- (getstring t (strcat "\nSpecify Suffix <" (if (eq "" Suff) "-None-" Suff) ">: "))))
- (mapcar '(lambda (x y) (or (or (not x) (eq "" x)) (set y x))) tmpVars dVars)
- (while (not ss)
- (princ "\nSelect Blocks to ReNumber... ")
- (setq ss (ssget '((0 . "INSERT") (66 . 1)))))
- (foreach blk (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
- (setq att (entnext blk))
- (while (not (eq "SEQEND" (cdadr (setq aLst (entget att)))))
- (if (eq "POINT" (cdr (assoc 2 aLst)))
- (entmod (subst (cons 1 (strcat Pref (rtos sNum) Suff)) (assoc 1 aLst) aLst)))
- (setq att (entnext att)))
- (setq sNum (+ sNum inNum)))
- (command "_regenall")
- (princ))
|