请问如何将文字样式修改程序
把CAD文档中的文字样式"mychina"转换成"standard"的程序,请大家指教,如何编写程序?更新组码7. (defun c:tt()
(setq ss (ssget))
(setq ssn (sslength ss))
(setq n 0)
(repeat ssn
(setq en(ssname ss n))
(setq ob (vlax-ename->vla-object en))
(vla-put-StyleName ob "standard")
(setq n (1+ n))
)
(print (strcat "共更新" (rtos ssn 2 0) "个对象"))
(princ)
) ;修改文字的字体
(defun *error*(st)
(princ (strcat "错误: " st))
(princ)
)
(defun C:xgzt(/ test ss len n en1 a oldr newr ent nn)
(setvar "CMDECHO" 0)
(setq test T nn 0)
(while test
(setq ss (ssadd))
(setq ss (ssget))
(if (= nil ss)
(setq test nil)
(progn
(setq len (sslength ss))
(setq n 1 s 1)
(while (<= n len)
(setq en1 (ssname ss (1- n)))
(setq a (entget en1))
(if(= "TEXT" (cdr (assoc 0 a)))
(progn
(if (= s 1)
(progn
(setq oldr (cdr (assoc 7 a)))
(setq newr (strcase (getstring (strcat "\n新字体 <" oldr ">:"))))
(if (= newr "") (setq newr oldr))
(setq s nil)
)
)
(if (= (tblsearch "style" newr) nil)
(progn
(cond ((= newr "XW")
(command "STYLE" "xw" "txt" "0" ".8" "0" "n" "n" "n"))
((= newr "HZ")
(command "STYLE" "hz" "txt,hztxt" "0" ".8" "0" "n" "n" "n"))
((= newr "CHINA")
(command "STYLE" "china" "txt,china" "0" ".8" "0" "n" "n" "n"))
((= newr "LM")
(command "STYLE" "lm" "complex" "0" ".8" "0" "n" "n" "n"))
(T (princ (strcat "\nPlease define style " newr " use STYLE command !")))
)
)
)
(setq ent (subst (cons 7 newr) (assoc 7 a) a))
(entmod ent)
(setq nn (1+ nn))
)
页:
[1]