ht1480 发表于 2022-10-28 14:51:01

改字,不知道来源于哪了,贴出来给我同样0基础的小伙伴学习。

(defun c:gz():;改字,点一下改一下
(prompt "请点取修改以后的值:")
(setq aa(car(entsel)))
(while aa
(setq a (cdr(assoc 1(entget aa))))
(setq a1(substr a 2 1))
(setq a2(substr a 3 1))
(if (= a1 ":")(setq a (substr a 3)))
(if (= a2 ":")(setq a (substr a 4)))
(prompt "请点取要修改的值:")
(setq b (entget(car(entsel))))
(setq b1 (cons '1 a))
(setq b(subst b1(assoc 1 b)b))
(entmod b)
(prompt "请点取修改以后的值:")
(setq aa(car(entsel)))
(princ)
)
)
(defun c:zg();改字,点一下一直改
(prompt "请点取修改以后的值:")
(setq aa(car(entsel)))
(while aa
(setq a (cdr(assoc 1(entget aa))))
(setq a1(substr a 2 1))
(setq a2(substr a 3 1))
(setq a3(substr a 4 1))
(if (= a1 ":")(setq a (substr a 4)))
(if (= a2 ":")(setq a (substr a 5)))
(if (= a2 ":")(setq a (substr a 6)))
(prompt "请点取要修改的值:")
(setq b (entget(car(entsel))))
(setq b1 (cons '1 a))
(setq b(subst b1(assoc 1 b)b))
(entmod b)
(princ)
)
)

逍遥无声 发表于 2022-10-29 03:08:42

:handshake:handshake:handshake:handshake:handshake

e2002 发表于 2022-10-29 14:38:26

用vl-string-search来确定字符串中是否有某个(某些)字符。
页: [1]
查看完整版本: 改字,不知道来源于哪了,贴出来给我同样0基础的小伙伴学习。