找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

楼主: lxw917

(完成)[求助]:一串数字,怎样一起增减

[复制链接]
发表于 2003-8-7 09:34:54 | 显示全部楼层
我是菜鸟,能否更详细地告诉我如何加载到晓东工具箱中!谢谢!!!!!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2003-8-7 22:40:17 | 显示全部楼层
贴两个以前写的.

  1. ;;---tval数字text/标高text改值工具————————lxx.2001.2m
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. (DEFUN C:tval (/ aa s i ll entt e v nv nvs)
  4. (princ "\n数字text/标高text改值工具————————lxx.2001.2m")
  5. (setq aa (getdist "\n差值-可为负值:") s (ssget) i 0 )
  6. (if (null (setq d (getdist "\n小数点后-精度<3>:")))(setq d 3))
  7. (REPEAT (SSLENGTH S)
  8.   (setq ll (ssname s i) entt (entget ll))
  9.   (if (= "TEXT" (cdr (assoc 0 entt)))
  10.       (progn
  11.         (setq e (assoc 1 entt)
  12.               v (atof (cdr e))
  13.               nv (+ v aa)
  14.               nvs(rtos nv 2 3)
  15.         )
  16.         (if (= 0.0 nv)(setq nvs (strcat "%%128" nvs)))
  17.         (setq entt (subst (cons 1 nvs) e entt))
  18.         (entmod entt)
  19.       )
  20.   )
  21.   (SETQ I (+ 1 I))
  22. )
  23. (princ)
  24. )
  25. (princ "\n 数字text/标高text改值工具————tval——————lxx.2001.2m")(princ)


  1. (princ "\ntxta ====txt add 文字增值 -----------lxx.2002.4")
  2. (defun c:txta ()
  3.   (princ "\ntxta====txt add 文字增值-----------lxx.2002.4")
  4.   (setq ss (ssget '((0 . "TEXT")))
  5.         nadd (getdist "\n增加值<1>:")
  6.         dec (getint "\n精度<0>:")
  7.         i 0)
  8.   (if (not nadd)(setq nadd 1))
  9.   (if (not dec)(setq dec 0))
  10.   (repeat (sslength ss)
  11.     (setq ent (ssname ss i)
  12.           entl (entget ent)
  13.           i (1+ i)
  14.     )
  15.     (txtadd entl nadd dec)
  16.   )
  17.   (princ)
  18. )
  19. ;;;;;txtadd
  20. (defun txtadd (entl nadd dec /)
  21.   (setq        bnam0 (cdr(assoc 1 entl)));;;old txt
  22.   (princ "\n原字串:")(princ bnam0)
  23.   ;;使得序号不重复
  24.   (setq nlen (strlen bnam0)
  25.         n1 1
  26.         lastn nil)
  27.   (while (and (/= 0 nlen)(member (substr bnam0 nlen 1) '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" ".")))
  28.         (setq lastn (atof (substr bnam0 nlen n1));;字串尾序号
  29.               nlen (1- nlen)
  30.               n1 (1+ n1)
  31.         )
  32.   );;end while
  33.   (if lastn;;;;;;;;确定新字串---尾序号累加nadd,无序号加nadd
  34.    (progn (setq lastn (+ lastn nadd))
  35.           (if (or (= 'INT (type (read bnam0))) (= 'REAL (type (read bnam0))));;当字串如"3"                       
  36.               (setq bnam (rtos lastn 2 dec))
  37.               (setq bnam (strcat (substr bnam0 1 nlen) (rtos lastn 2 dec)))
  38.           )
  39.    )
  40.    (progn (setq lastn nadd)         ;;else
  41.           (if (or (= 'INT (type (read bnam0)))(= 'REAL (type (read bnam0))))
  42.               (setq bnam (rtos lastn 2 dec))
  43.               (setq bnam (strcat bnam0 (rtos lastn 2 dec)))
  44.           )
  45.    )
  46.   );;end if
  47.   (princ " 改为:")(princ bnam)
  48.   (setq entl (subst (cons 1 bnam) (assoc 1 entl) entl))
  49.   (entmod entl)(entupd ent)
  50. )
  51.                  
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-9-20 08:06 , Processed in 0.347627 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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