本帖最后由 gaics 于 2020-8-12 08:36 编辑
- (defun c:tt (/ name D en zt3 zt4 a b c d e f g err)
- (setvar "cmdecho" 0)
- (while (setq D (tblnext "style" (null D)))
- (setq name (cdr (assoc 2 D)))
- ;;;;(alert name)
- (setq zt3 (cdr (assoc 3 D)))
- (setq zt4 (cdr (assoc 4 D)))
- (if (/= zt3 "")
- (cond
- ((or (= (vl-filename-extension zt3) ".shx")
- (= (vl-filename-extension zt3) ".SHX")
- )
- (if (not (findfile zt3))
- (setq zt3 "hzasc.shx"
- a t
- )
- )
- )
- ((null (vl-filename-extension zt3))
- (if
- (findfile (strcat zt3 ".shx"))
- (setq zt3 (strcat zt3 ".shx")
- a t
- )
- (setq zt3 "hzasc.shx"
- a t
- )
- )
- )
- ((if
- (not (findfile (strcat (getenv "windir") "\\fonts\\" zt3)))
- (setq zt3 "simkai.ttf"
- b t
- )
- )
- )
- )
- (progn
- (setq en (vlax-ename->vla-object (tblobjname "style" name)))
- (vla-getfont en 'c 'd 'e 'f 'g)
- (setq
- err (vl-catch-all-apply 'vla-setfont (list en c d e f g))
- )
- (if (vl-catch-all-error-p err)
- (vla-setfont en "楷体" d e f g)
- )
- )
- )
- (if (/= zt4 "")
- (if (vl-filename-extension zt4)
- (if (not (findfile zt4))
- (setq zt4 "hztxt.shx"
- a t
- )
- )
- (if (findfile (strcat zt4 ".shx"))
- (setq zt4 (strcat zt4 ".shx")
- a t
- )
- (setq zt4 "hztxt.shx"
- a t
- )
- )
- )
- )
- (if a
- (command "-style" name (strcat zt3 "," zt4) "" "" "" "" "" "")
- )
- (if b
- (command "-style" name zt3 "" "" "" "" "")
- )
- (setq a nil b nil)
- )
- (princ)
- )
重新写了一下,感觉这版问题少一些。但是对外部参照缺失的字体会出错。 |