替换字体过滤掉0层或者只替换dim层
使用这个代码替换字体是连图框内的文字也替换了,打印比较丑,如何改成只替换dim层的或者不替换0层,或者不替换块内文字,
自己用AI生成的总是没反应 请教
(defun c:QQ (/ name D en)
(command "-STYLE" "txt" "txt.shx" "0" "0.8" "0" "N" "N" "N")
(command "-STYLE" "ma2" "ma2.shx" "0" "0.8" "0" "N" "N" "N")
(while (setq D (tblnext "style" (null D)))
(setq name (cdr (assoc 2 D)))
(setq en (tblobjname "style" name))
(ch_dxf en 3 "txt.shx") ;替换abcd123
(ch_dxf en 4 "ma2.shx");替换汉字
)
(command "REGEN")
;(alert "已替换字体")
(princ)
)
(defun ch_dxf (en num ch / old new ent)
(if (setq ent(entget en)
new(cons num ch)
old(assoc num ent)
)
(entmod (subst new old ent))
(entmod (reverse (cons new (reverse ent))))
)
)
修改style将会忽略layer作用于相应图元。要特定图层上的图元style不一样,需要定义两种style,然后根据图元所在图层设置。
页:
[1]