[源码]字母与数字组合字符串的增量复制 -- 待完善
<p>(defun c:xcc (/ )<br/>(setq i 1)<br/>(setvar "cmdecho" 0)<br/>(if (setq ee (entsel "\n选择数字 <退出>: "))<br/> (progn<br/> (setq str (cdr (assoc 1 (entget (car ee)))) ;;返回所选文字<br/> pt1 (cadr ee) ;;返回选择点,作为copy的第一点<br/> strs (substr str 1 (aa str)) ;;截取非数字字符<br/> strn (substr str (+ (aa str) 1) (strlen str))) ;;截取数字字符<br/> (command "copy" ee "" "m" pt1 <br/> (while (progn <br/> (setq news (strcat strs (itoa (+ (atoi strn) i))))<br/> (setq i (+ 1 i) pt1 pt2)<br/> (command pause) ;;暂停等待屏幕输入<br/> (setq pt2 (getvar "LASTPOINT")) ;;获取输入点<br/> (setq e (entlast))<br/> (entmod (subst (cons 1 news)(assoc 1 (entget e))(entget e)))<br/> (princ news)(princ "\n选择数字 <退出>: ")<br/> (not (eq pt1 pt2))<br/> )))<br/> )<br/> )<br/> (princ)<br/>)</p><p>;;返回数字在字符中的位置<br/>(defun aa(tr / n i m k)<br/>(setq n (strlen tr) i 0 k -1)<br/>(while (< i n)<br/> (setq m (substr tr (- n i) 1))<br/> (if (/= (itoa (atoi m)) m) (setq k i i n))<br/> (setq i (+ i 1)))<br/>(- (strlen tr) (if (= k -1) i k))<br/>)</p> 嘿嘿!好东西啊!向楼主学习 什么行业能用的上这么大的数?楼上是做天文学的吗? <p><strong><font face="Verdana" color="#61b713">liminnet</font></strong>有功夫帮忙把一楼的代码完善一下啊,好像有点问题。</p>
页:
[1]