我用这个:
- ;;; Replaces selected attribute value with new one and adds sequential number at the end
- ;;; Author paulmcz Copyright© 2006
- (defun c:qs (/ ans st nw oerr e1 e2 natt)
- (setq oerr *error*)
- (defun *error* (msg)
- (princ "\n ERROR!")
- (setq *error* oerr)
- (command)
- (princ)
- )
- (if ns
- (princ (strcat "\n Previous text = " ns (itoa stt)))
- )
- (if ns
- (setq
- ans (getstring
- "\n Keep previous text? [ENTER = yes]: "
- )
- )
- )
- (if (= ans "")
- ()
- (setq ns nil
- st nil
- )
- )
- (if ns
- ()
- (setq ns (getstring t "\n Type in new text: "))
- )
- (if stt
- ()
- (setq stt 1)
- )
- (princ "\n Start with number < ")
- (princ stt)
- (princ " >?: ")
- (setq st (getint))
- (if (= st nil)
- (setq st stt)
- (setq stt st)
- )
- (setq nw (strcat ns (itoa st)))
- (setq e1 (nentsel "\n Select attribute, do not miss: "))
- (while e1
- (setq e2 (entget (setq natt (car e1))))
- (entmod (subst (cons 1 nw) (assoc 1 e2) e2))
- (entupd natt)
- (if (eq (cdr (assoc 0 e2)) "ATTRIB")
- (setq st (+ 1 st))
- (princ "\n You missed! ")
- )
- (if st
- (setq nw (strcat ns (itoa st))
- stt st
- )
- )
- (setq e1 (nentsel "\n Select next attribute or [ENTER] to exit: "))
- )
- (princ)
- )
- (prompt "\n Type > qs < to update attributes: ")
它不是为复制和粘贴而制作的,但其工作方式类似。试试看。 |