明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 26658|回复: 103

单多行数字复制递进

  [复制链接]
发表于 2012-4-7 10:41 | 显示全部楼层 |阅读模式





该贴已经同步到 【KAIXIN】的微博

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

评分

参与人数 2明经币 +1 金钱 +18 收起 理由
czb203 + 1 赞一个!
左怀政 + 18

查看全部评分

发表于 2012-4-7 16:24 | 显示全部楼层
本帖最后由 wowan1314 于 2012-4-8 11:54 编辑

搞定了! 论坛上东拼西凑了!基本满足要求
还有个函数!?
  • (defun ureal (bit kwd msg def / inp)
  •   (if def
  •     (setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
  •           bit (* 2 (fix (/ bit 2)))
  •     )
  •     (setq msg (strcat "\n" msg ": "))
  •   )
  •   (initget bit kwd)
  •   (setq inp (getreal msg))
  •   (if inp
  •     inp
  •     def
  •   )
  • )


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

点评

大神能不能发个 pjykxjh@163.com  发表于 2015-12-16 11:18
没有权限下载  发表于 2015-12-16 11:18
我想下载,可惜权限不够  发表于 2014-8-24 19:35
动态的,不错啊。就是权限高了点。  发表于 2013-5-24 17:46
如果支持汉字数字会更好  发表于 2012-4-7 20:52
要嘚!非常的支持你!  发表于 2012-4-7 19:04

评分

参与人数 5明经币 +3 金钱 +52 收起 理由
muwind + 1 正好需要
Aguo + 1 + 20 赞一个!
aaacjh + 20 楼主的豪情!令人敬仰!
669423907 + 1 很给力!
【KAIXIN】 + 12 赞一个!

查看全部评分

回复 支持 2 反对 0

使用道具 举报

发表于 2017-12-14 10:59 | 显示全部楼层
wowan1314 发表于 2012-4-7 16:24
搞定了! 论坛上东拼西凑了!基本满足要求
还有个函数!?

哥~大哥~ 能分享我一个吗?超级感谢   y10086520@163.com
发表于 2021-10-25 00:12 | 显示全部楼层
wowan1314 发表于 2012-4-7 16:24
搞定了! 论坛上东拼西凑了!基本满足要求
还有个函数!?

很好的插件,不够条件下载不了,谢谢
发表于 2012-4-7 10:58 | 显示全部楼层
好程序,谢金!

点评

【KAIXIN】----通用函数(全部源码)低价抛售中! 地址:http://bbs.mjtd.com/thread-99208-1-1.html  发表于 2013-1-24 18:30
发表于 2012-4-7 11:03 | 显示全部楼层
本帖最后由 wowan1314 于 2012-4-7 11:19 编辑

晕! 说明下撒!  VLX版的还收币哦都那么有钱了! 哎! 又少一个币!

点评

幸苦的成果要一点币也是正常!我的币会用在上进的奖励的  发表于 2012-4-7 12:11
发表于 2012-4-7 11:30 | 显示全部楼层
来观望开心大师的作品

点评

【KAIXIN】----通用函数(全部源码)低价抛售中! 地址:http://bbs.mjtd.com/thread-99208-1-1.html  发表于 2013-1-24 18:30
请不要叫大师,是看很多朋友需要才共享的......  发表于 2012-4-7 12:13
 楼主| 发表于 2012-4-7 12:14 | 显示全部楼层
用到自己一些通用函数,所以源码没有共享,勿怪.....
发表于 2012-4-7 13:27 | 显示全部楼层
看大师作品就是不同,效果惊人,不知对中间带有"-"的支持不,如1-2.

点评

【KAIXIN】----通用函数(全部源码)低价抛售中! 地址:http://bbs.mjtd.com/thread-99208-1-1.html  发表于 2013-1-24 18:30
发表于 2012-4-7 15:41 | 显示全部楼层
开心又出新花样,开心

点评

【KAIXIN】----通用函数(全部源码)低价抛售中! 地址:http://bbs.mjtd.com/thread-99208-1-1.html  发表于 2013-1-24 18:30
发表于 2012-4-7 16:06 | 显示全部楼层
本帖最后由 wowan1314 于 2012-4-7 16:09 编辑

怒了,我来发源码!!
发个半成品先! 只能加1  且只对复制的第一个加1

成品应该快了!

点评

【KAIXIN】----通用函数(全部源码)低价抛售中! 地址:http://bbs.mjtd.com/thread-99208-1-1.html  发表于 2013-1-24 18:31
发表于 2012-4-7 16:08 | 显示全部楼层
;;
(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 "[0-9.]")
        (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
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-19 03:21 , Processed in 0.241065 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表