只需一步,快速开始
您需要 登录 才可以下载或查看,没有账号?注册
使用道具 举报
几个问题1.这些编号只改同一图层的?2.是否考虑中间有横杠的情况,比如W1-4,如果考虑,那么增加的是横杠前面的数字还是横杠后面的数字,比如是改成W1-5还是W2-4还是W2-5呢?
OK
试试
;;序号递增程序 V1.0 by sailorcwx (2006.11)(defun c:numadd ( / YH_ENTDATA YH_ENTLAYER YH_ENTLIST YH_INDEX YH_POSITION YH_REPEATTIMES YH_SNUM0 YH_SNUM01 YH_SNUM02 YH_SNUM1 YH_SNUM11 YH_SNUM12 YH_SNUMDATA YH_SSGETFILTER) (while (setq YH_entdata (entget (car (entsel "\n选择一个参考编号:"))) YH_entlayer (assoc 8 YH_entdata) YH_snum0 (cdr (assoc 1 YH_entdata)) ) (princ "OK") (if (vl-string-search "-" YH_snum0) (setq YH_position (vl-string-search "-" YH_snum0)) (setq YH_position 0)) (setq YH_snum01 (substr YH_snum0 1 (+ 1 YH_position)) YH_snum02 (atoi (substr YH_snum0 (+ 2 YH_position))) YH_ssgetfilter (list YH_entlayer (cons 1 (strcat YH_snum01 "*"))) ) (setq YH_entlist (ssget YH_ssgetfilter) YH_index 0 YH_repeattimes (sslength YH_entlist) ) (repeat YH_repeattimes (setq YH_snumdata (entget (ssname YH_entlist YH_index)) YH_snum1 (cdr (assoc 1 YH_snumdata)) YH_snum11 (substr YH_snum1 1 (+ 1 YH_position)) YH_snum12 (substr YH_snum1 (+ 2 YH_position)) ) (if (and (not (vl-string-search "-" YH_snum12)) (> (setq YH_snum12 (atoi YH_snum12)) YH_snum02)) (progn (setq YH_snum12 (itoa (+ 1 YH_snum12)) YH_snum1 (strcat YH_snum11 YH_snum12) YH_snumdata (subst (cons 1 YH_snum1) (assoc 1 YH_snumdata) YH_snumdata) ) (entmod YH_snumdata) ) ) (setq YH_index (1+ YH_index)) ) ) (princ) )
多谢
这个不是CAD里面有批量图层的命令吗?难道还要编程啊!不过即使编写也不需要那么复杂的,千万别把简单的事情给复杂化了,这样不好,批量改图层不过是遍历图层,然后将序号增加一位
sub sfdsfdf()
dim pppplayer as acadlayer
for each pppplayer in thisdrawing.layers
pppplayer.name=pppplayer.name+"此处为所添加的东西"
pppplayer.update
next pppplayer
end sub
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 ) ©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途
GMT+8, 2025-2-27 20:01 , Processed in 0.207404 second(s), 24 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.