本帖最后由 自贡黄明儒 于 2013-10-28 16:49 编辑
;;如是前后有整数,那就好办了
- (defun NumberChange (str num / STR1 STR2)
- (cond ((setq str1 (car (xd::string:regexps "\\d+$$" str "")))
- (setq str2 (itoa (+ (atoi str1) num)))
- (XD::String:Replace "\\d+$$" str str2 "")
- )
- ((setq str1 (car (xd::string:regexps "^\\d+" str "")))
- (setq str2 (itoa (+ (atoi str1) num)))
- (XD::String:Replace "^\\d+" str str2 "")
- )
- )
- )
- (defun C:w1 (/ EN ENTLIS N SS STR)
- (if (setq ss (ssget '((1 . "*#*"))))
- (repeat (setq n (sslength ss))
- (setq en (ssname ss (setq n (1- n))))
- (setq entlis (entget en))
- (setq str (cdr (assoc 1 entlis)))
- (if (setq str (NumberChange str 10))
- (entmod (subst (cons 1 str) (assoc 1 entlis) entlis))
- )
- )
- )
- )
|