单多行数字复制递进
http://bbs.mjtd.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 【KAIXIN】的微博 本帖最后由 wowan1314 于 2012-4-8 11:54 编辑
搞定了! 论坛上东拼西凑了!基本满足要求
还有个函数!?
[*](defun ureal (bit kwd msg def / inp)
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif(if def
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif (setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif bit (* 2 (fix (/ bit 2)))
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif )
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif (setq msg (strcat "\n" msg ": "))
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif)
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif(initget bit kwd)
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif(setq inp (getreal msg))
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif(if inp
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif inp
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif def
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif)
[*]http://bbs.mjtd.com/source/plugin/mc_colorcode/images/jssc_none.gif)
wowan1314 发表于 2012-4-7 16:24
搞定了! 论坛上东拼西凑了!基本满足要求
还有个函数!?
哥~大哥~ 能分享我一个吗?超级感谢 y10086520@163.com wowan1314 发表于 2012-4-7 16:24
搞定了! 论坛上东拼西凑了!基本满足要求
还有个函数!?
很好的插件,不够条件下载不了,谢谢 好程序,谢金! 本帖最后由 wowan1314 于 2012-4-7 11:19 编辑
晕! 说明下撒!VLX版的还收币哦都那么有钱了! 哎! 又少一个币!
来观望开心大师的作品 用到自己一些通用函数,所以源码没有共享,勿怪..... 看大师作品就是不同,效果惊人,不知对中间带有"-"的支持不,如1-2. 开心又出新花样,开心 本帖最后由 wowan1314 于 2012-4-7 16:09 编辑
怒了,我来发源码!!
发个半成品先! 只能加1且只对复制的第一个加1
成品应该快了!
;;
(defun C:T11 ( / SS SS1 e0 ent PT i loop ENTL E-1 NEWTX ENT_TMP)
(setq ss (ssget '((0 . "*TEXT"))))
(setq e0 (entlast))
(setq pt (getpoint "指定基点:"))
(command "copy" ss "" pt pause)
(setq loop T)
(while loop
(SETQ SS1 (last_ent E0) I 0)
(repeat (sslength ss1)
(setq ent (ssname ss1 i)
entl (entget ent);图元资料
e-1 (cdr (assoc 1 entl));;文字内容
i (1+ i)
NEWTX (Plus1 E-1)
)
(entmod (subst (cons 1 NEWTX) (assoc 1 entl) entl));更新文字
);end repeat
(setq e0 (entlast))
(command "copy" ss "" pt pause)
(setq Point (getvar "LastPoint"))
(if (= 0 (distance Point pt)) ;判断最后一点是不是pt点.
(progn
(setq loop nil) ;Right Button
(setq ent_tmp (LAST_ENT e0)) ;ent_tmp 是e0后生成的物体.
(command "_.erase" ent_tmp "" )
)
)
);end while
)
(defun last_ent (en / ss)
(if en
(progn
(setq ss (ssadd))
(while (setq en (entnext en))
(if (not (member (cdr (assoc 0 (entget en)))
'("ATTRIB" "VERTEX" "SEQEND")
)
)
(ssadd en ss)
);if
);while
(if (zerop (sslength ss)) (setq ss nil))
ss
);progn
(ssget "_x")
);if
)
(defun Plus1 (str / d1 d2 h)
(setq str (vl-string-translate "-" (chr 1) str))
(setq d1 (last (string_to_numbers str))
h (vl-string-right-trim d1 str))
(setq d2 (vl-princ-to-string (1+ (read d1))))
(while (< (strlen d2) (strlen d1))
(setq d2 (strcat "0" d2))
)
(vl-string-translate (chr 1) "-" (strcat h d2))
)
;;; Bill Kramer
;
(defun String_To_Numbers (
inStr;;Input string
/
Res ;;Result list
Buf ;;String buffer
Inx ;;Character location
CH ;;Character
)
(setq Inx 1 ;start at the beginning of the string
Buf "" ;init buffer to empty
)
;
; Loop until the end of the string.
; (I indicates where we are in the string)
;
(while (<= Inx (strlen inStr))
;
; Get the character at position Inx, increment position indicator
(setq CH (substr inStr Inx 1)
Inx (1+ Inx)
)
;
(cond
; Test to see if character is a digit.
((wcmatch CH "")
(if (= CH ".") ;is it decimal?
(if (not (wcmatch Buf "*`.*")) ;not already in there
(setq Buf (strcat Buf CH))
(Flush_Buf))
;
(setq Buf (strcat Buf CH)))
)
((= Buf "") ;is the buffer empty?
;Is CH minus
(if (= CH "-")
(setq Buf CH) ;Yes, save in Buf
)
)
('T ;else buffer is not empty
(Flush_Buf)
(if (= CH "-")
(setq Buf CH))
)
); End of COND
); End of WHILE
;
(if (and (/= Buf "")
(not (wcmatch Buf "[+-.]"))
)
(Flush_Buf))
(reverse Res)
)
(defun Flush_Buf ()
(if (not (wcmatch Buf "[+-.]")) ;is it not just +-.?
(progn
;Clean it up first
(if (= (substr Buf 1 1) ".")
(setq Buf (strcat "0" Buf))) ;;add zero to front if .#
(if (= (substr Buf (strlen Buf)) ".")
(setq Buf (substr Buf 1 (1- (strlen Buf))))) ;;remove decimal if #.
;Add to RES list
(setq RES (cons Buf RES))))
(setq Buf "") ;;reset Buf
)