马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 /db_自贡黄明儒_ 于 2014-10-25 09:02 编辑
以前05版我的下面的代码是能用的,没有发现有什么问题。也许是几天安装了04版,问题来了.... - ;;;*********************************************************
- ;;[功能] 设模板文件路径
- ;;假定我的模板文件a4.dwt在支持文件搜索路径中
- ;;1 设置模板文件路径
- ;;2 设置快速新建启用的模板文件
- (defun HH:TemplateDwgPath (/ CPATH FILESEL MSPACE MYDWT PREFERENCESEL)
- (VL-LOAD-COM)
- (or *acad* (setq *acad* (vlax-get-acad-object)))
- (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*)))
- (setq mSpace (vla-get-ModelSpace *doc*))
- (setq preferenceSel (vla-get-Preferences *acad*))
- (setq fileSel (vla-get-Files preferenceSel))
- ;;取出当前的 TemplateDWGPath值
- (setq cPath (vla-get-TemplateDwgPath fileSel))
- ;;取得a4.dwt所在路径
- (setq cPath (vl-filename-directory (findfile "a4.dwt")))
- ;;改变 TemplateDWGPath的值
- (cond ((and cPath (not (equal cPath cPath))) (vla-put-TemplateDwgPath fileSel cPath)))
- ;;快速新建时启用的模板文件(2004以上的才能用)
- (cond((and (> (atof (getvar "ACADVER")) 16)
- cPath
- (setq MyDWT (vla-get-QNewTemplateFile fileSel))
- (not (equal (VL-FILENAME-BASE MyDWT) "a4"))
- )
- (vla-put-QNewTemplateFile fileSel (findfile "a4.dwt"))
- )
- )
- (princ)
- )
- (VL-CATCH-ALL-APPLY 'HH:TemplateDwgPath nil)
- ;;;*********************************************************
|