linshucai 发表于 2007-12-26 15:53:00

[灌水]你的文字样式有问题?这个小程序帮你解决。

<p>参考网友程序进行修改而成</p><p>(defun c:chtxsy ( / a b1 b2 e f index n ns zt)<br/>&nbsp;&nbsp;&nbsp; (setvar "cmdecho" 0)<br/>&nbsp;&nbsp;&nbsp; (command "purge" "a" "*" "n")<br/>    (setq A (ssget "x" '((0 . "TEXT,MTEXT"))))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (tblsearch "style" "XIAOLIN") <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (command "-style" "XIAOLIN" "txt.shx,hztxt.shx" "" "0.7" "" "" "" "")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setvar "dimtxsty" "standard")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ "正在处理中.....\n")<br/>    (setq ns "XIAOLIN")<br/>    (setq n (sslength a))<br/>    (setq index 0)<br/>    (repeat n<br/>       (setq b1 (entget(ssname a index)))<br/>       (setq index (+ index 1))<br/>       (setq e (assoc 7 b1))<br/>       (setq f (cons (car e) ns))<br/>       (setq b2 (subst f e b1))<br/>       (entmod b2)<br/>       )<br/>(command "-style" "hztxt" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "chian" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "dim_font" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "ht" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "hz" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "romand" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "standard" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "yy" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "ro" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "style1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "-黑体" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "simplex" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "h1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "youyuan" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "hz" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "kt64f" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "lushu" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "kaiti" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "meihei" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "songti" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "zongyi" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "宋体" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_simplex" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "att" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "dim" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "黑体" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "楷体" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "幼圆" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "华文" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "style2" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "style3" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "华文中宋" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "2" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "3" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "text" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "text1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "text2" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "dim" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "dim1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "dim2" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_ht64f" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_hzls" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_txt" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "2" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "3" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "4" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "5" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "6" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "ht" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_hzdx" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_cibt____" "txt.shx,hztxt.shx" "" "" "" "" "" "") <br/>(command "-style" "comb" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "middle" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_fds" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_romanc" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "cg" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "fs1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_fs1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "std" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_fsj" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "fs" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "st" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "LP1" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "ROMANT" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "lp2" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_HZTXT" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "_COMPLEX" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "-style" "complex" "txt.shx,hztxt.shx" "" "" "" "" "" "")<br/>(command "purge" "a" "*" "n")<br/>(princ "\n 字体转换成功!")<br/>(setvar "cmdecho" 1)<br/>(princ )<br/>  )</p><p>;以方便各位解决字体问题。</p>

hustrys 发表于 2008-1-1 12:02:00

<p>这样更简单</p><p></p><p>更换所有文字字体</p><p>(defun C:zas ()<br/>&nbsp;&nbsp; (graphscr)<br/>&nbsp;&nbsp; (initget 7)<br/>&nbsp;&nbsp; ;(setq c1 (getstring "\nInput new color for all layers: "))&nbsp;&nbsp; ;输入新颜色<br/>&nbsp;&nbsp; (setq a1 (tblnext "style" t))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;将指针移到第一个字体<br/>&nbsp;&nbsp; ;&nbsp; (princ a1)<br/>&nbsp; ;(setq a2 (cdr (assoc 2 a1)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;取出图层名称<br/>&nbsp;&nbsp;&nbsp; ;&nbsp; (setq a3 (entget (tblobjname "style" a2)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;取出图层的数据串行<br/>&nbsp;&nbsp;&nbsp; ;&nbsp; (princ "&nbsp; a3= ")(princ a3)<br/>&nbsp; (while a1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq a2 (cdr (assoc 2 a1)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;取出字体名称<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq a3 (entget (tblobjname "style" a2)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;取出字体的数据串行<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;(princ a3)(princ "&nbsp;&nbsp; ")<br/>&nbsp;&nbsp;&nbsp; (setq a3 (subst (cons 3 "txt_0.shx") (assoc 3 a3) a3))&nbsp;&nbsp;&nbsp; ;将字体字型改成新字型<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (entmod a3)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;更新字体<br/>&nbsp;&nbsp;&nbsp; (setq a3 (subst (cons 4 "hzfs.shx") (assoc 4 a3) a3))&nbsp;&nbsp;&nbsp; ;将字体字型改成新字型<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (entmod a3)&nbsp; <br/>&nbsp;&nbsp;&nbsp; (setq a1 (tblnext "style"))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;找出下一个字体<br/>&nbsp;&nbsp; )<br/>&nbsp; (command"REGEN" "")<br/>&nbsp; (princ"字型变更成功!" )<br/>&nbsp;&nbsp; (princ)<br/>)</p>

新黎既 发表于 2012-1-2 21:37:12

直接更改很方便

;;;改所有字体为: rs,hztxt
(defun c:rshz (/ a3 ss j n ed)
(print "程序正在执行中,请稍后......")
(command "style" "hz" "rs.shx,hztxt.shx" "" "" "" "")
(setq a3 "hz")
(setq ss (ssget "x" (list (cons 0 "text"))))
(setq n (sslength ss))
(setq j 0)
(while (< j n)
   (setq ed (ssname ss j))
   (command "change" ed "" "" "" a3 "" "" "")
   (setq j (+ j 1))
   )
)

sy100 发表于 2012-1-2 22:44:13

谢谢!学习了

lingduwx 发表于 2012-1-4 11:49:23

不知道能不能更换多行文字字体哦,要是能够设置选择哪些字体更换成另外的字体就好了

清风明月名字 发表于 2012-5-18 19:23:53

谢谢各位,太好了

AMTONNY 发表于 2012-5-18 19:42:07

学习了,好贴子要顶起来

hvac_wh 发表于 2012-5-19 02:44:27

这种没有效率的搞法,让人昏!我有一次性将所有字型改为同一字体程序,我编制的,需要请联系
页: [1]
查看完整版本: [灌水]你的文字样式有问题?这个小程序帮你解决。