对不起,我迟了回复,我必须先完成我的紧急工作。
试试这个程序,让我知道。
- (defun c:Test (/ s val)
- ;; Tharwat 06.Aug.2015 ;;
- (if (and (/= ""
- (setq
- val (getstring
- "\nEnter a number to add to attributes in blocks :"
- )
- )
- )
- (numberp (read val))
- (princ "\nSelect Attributed Blocks")
- (setq s (ssget "_:L" '((0 . "INSERT") (66 . 1))))
- )
- ((lambda (i / sn str l no st)
- (while (setq sn (ssname s (setq i (1+ i))))
- (mapcar
- '(lambda (u)
- (setq str (vla-get-textstring u)
- l nil
- no nil
- st nil
- l (vl-string->list str)
- )
- (mapcar '(lambda (n)
- (if (< 47 n 58)
- (setq no (append no (list n)))
- (setq st (append st (list n)))
- )
- )
- l
- )
- (if no
- (vla-put-textstring
- u
- (vl-string-subst
- (itoa (+ (read val) (read (vl-list->string no))))
- (vl-list->string no)
- str
- )
- )
- )
- )
- (vlax-invoke (vlax-ename->vla-object sn) 'getattributes)
- )
- )
- )
- -1
- )
- )
- (princ)
- )(vl-load-com)
|