下面的这个LISP函数无法执行,提示"错误: Automation 错误。 文件处理器错误",求解决或者修改办法(defun c:KAt (/ myacad mydoc myms newtextnewfontfile newbigfontfile NEWSTRSTR ss obj POS STRL);改变字体为楷件(vl-load-com)(setq myacad (vlax-get-acad-object))(setq mydoc (vla-get-activedocument myacad))(setq myms (vla-get-modelspace mydoc))(Setq newText (vla-add (vla-get-TextStyles mydoc) "楷体"))(setq newFontFile "C:\WINDOWS\Fonts/simkai.ttf")(vla-put-FontFile newText newFontFile)(prompt"\nSelect MTEXT OR TXT to be changed to <楷体 style>by 向赞扬")(setq ss (ssget '((-4 . "<or")(0 . "TEXT")(0 . "MTEXT")(0 . "DIMENSION")(-4 . "or>"))))(repeat (setq I (sslength SS))(setq OBJ (vlax-ename->vla-object (ssname SS (setq I (1- I)))))(setq objname (vla-get-ObjectName OBJ))(if (or (= objname "AcDbMText") (= objname "AcDbText"))(progn(SETQ str (vla-get-TextString OBJ))(IF (WCMATCH STR "*;*")(PROGN (SETQ STRL (STRLEN STR))(setq pos (vl-string-position 59 str))(IF (/= STRL POS)(SETQ POS (+ POS 2)))(SETQ NEWSTR (substr str pos (- STRL pos)))(setqNEWSTR(strcat "{\\fKaiTi_GB2312|b0|i0|c134|p49;" NEWSTR "}"))(vla-put-TextString OBJ NEWSTR)))(vla-put-StyleName OBJ "楷体")))(if (= objname "AcDbRotatedDimension")(vla-put-TextStyle OBJ "楷体"))))谢谢了
1 回答
开满天机
TA贡献1786条经验 获得超13个赞
(setq newFontFile "C:\WINDOWS\Fonts/simkai.ttf")
改为
(setq newFontFile "C:\\WINDOWS\\Fonts\\simkai.ttf")
或者
(setq newFontFile "C:/WINDOWS/Fonts/simkai.ttf")
添加回答
举报
0/150
提交
取消