求一个代码,点文字后自动增加字符“%%u”,如果文字前三个字符是“%%u”,则删除%%u
用来给钢筋符号加下划线,谢谢~ 麻烦用while语句,可以连续点选框选;看看下面这个行不行,未测试
(defun c:wzshx()
(setvar "cmdecho" 0)
(command "_undo" "be" )
(while (setq ent (car (entsel "\n请选取文字:")))
(setq dxf (entget ent))
(setq name (cdr (assoc 0 dxf)))
(If (= name "TEXT")
(progn
(setq dxf1 (assoc 1 dxf))
(setq zfc (cdr dxf1))
(If (wcmatch zfc "%%u*")
(setq dxf (subst (cons 1 (substr zfc 4)) dxf1 dxf))
(setq dxf (subst (cons 1 (strcat "%%u" zfc)) dxf1 dxf))
)
(entmod dxf)
)
(alert "所选取的图元不是单行文字!")
)
)
(command "_undo" "e")
(setvar "cmdecho" 1)
(princ)
) yshf 发表于 2021-11-13 17:22
;看看下面这个行不行,未测试
(defun c:wzshx()
(setvar "cmdecho" 0)
可以了,谢谢~ 这个用增加删除前后缀的就可以了吧
页:
[1]