立即注册 登录
晓东CAD家园-论坛 返回首页

lsy的个人空间 http://bbs.xdcad.net/?13995 [收藏] [复制] [分享] [RSS]

留言板

facelist doodle涂鸦板

您需要登录后才可以留言 登录 | 立即注册


xunzhao123 2013-8-27 19:46
你好 能不能把你程序设计为保留小数点后两位数发给我,非常谢谢你的帮助
你的程序:
[font=courier new]
(defun C:NUM ()
(setq ss1 (ssget)
      len1 (sslength ss1)
      cnt 0
      add (getreal "\nEnter number to add to elevations:  ")
      )
(while (< cnt len1)
  (setq dent (entget (ssname ss1 cnt))
        txt (cdr (assoc 1 dent))
        len (strlen txt)
        cnt1 1
        )
   (while (<= cnt1 len)
    (if (/= (substr txt cnt1 1) " ")
     (progn
      (setq num (atof (substr txt cnt1 len))
            numlen (strlen (rtos num 2 5)))
       (if (/= num 0)
         (progn   
          (cond ((= (substr txt cnt1 numlen) (rtos num 2 5)) (setq sp 0))
                ((= (substr txt cnt1 (- numlen 1)) (rtos num 2 1)) (setq sp 1))
                ((= (substr txt cnt1 (- numlen 3)) (rtos num 2 0)) (setq sp 3))
            );cond      
            (setq rtxt (substr txt (- (+ cnt1 numlen) sp) len)
                  num (+ add num)
                  numt (rtos num 2 5)
                  ntx  (strcat (substr txt 1 (-  cnt1 1)) numt rtxt)
                  old (assoc 1 dent)
                  new (cons 1 ntx)
                  dent (subst new old dent)   
                  cnt1 (+ 1 len)
               );setq
                (entmod dent)
               );progn
             )));if,progn,if
        (setq cnt1 (1+ cnt1))      
      );end while
  (setq cnt (1+ cnt))   
);while
);defun
[/font]

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-4-27 06:18 , Processed in 0.119602 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部