第3个回答 推荐于2017-10-14
因为长时间没接触CAD编程,所以很多函数都给忘记了,花了点时间,下面是源代码,将下列源代码复制粘贴到TXT文档,保存文件名为 bianhao.lsp 然后在CAD中打开菜单——工具——加载运用程序,然后选择刚刚保存的文件,然后在命令栏输入FF回车,选择你所需要+1的编号,OK!(defun C:ff ()
(if (setq a (car (entsel "\n请选择需要+1的编号:"))) (progn
(setq ent (entget a)
c (cdr (assoc 0 ent)))
(if (wcmatch c "*TEXT") (progn
(setq txt (atoi(cdr(assoc 1 ent)))
txt (1+ txt)
ent (subst (cons 1 (itoa txt)) (assoc 1 ent) ent))
(entmod ent)
(setq txt (1+ txt))
(while (setq ss (ssget "X" (list (cons 0 c) (cons 1 (itoa txt)))))
(setq ss (ssdel a ss)
txt (1+ txt)
a (ssname ss 0)
ent (entget a)
ent (subst (cons 1 (itoa txt)) (assoc 1 ent) ent))
(entmod ent)
)
))
))
(princ)
)本回答被网友采纳