本帖最后由 qmqyqj 于 2019-8-12 11:10 编辑
可通过拖拽的方式将当前lisp程序的路径添加到支持的搜索目录,但通过AP加载的方式就不行,不知道什么原因造成的,希望有高手指点一下- ;;添加当前文件路径
- ;;;运行路径设置常数
- (setq envstr(getenv "processor_architecture"))
- (if(vl-string-search "64" envstr)
- (setq X64 T)
- (setq X64 nil)
- )
- (vl-load-com)
- (vl-catch-all-apply
- '(lambda ( / nn str html)
- (while (= (logand (getvar "CmdActive") 1) 1) (command))
- (princ "\n")
- (command "_.copyhist")
- (and (setq html (vlax-create-object "htmlfile"))
- (setq str (vlax-invoke-method (vlax-get (vlax-get html 'parentwindow) 'clipboarddata) 'getdata "text")
- str (strcase (if (= (type str) 'variant) (vlax-variant-value str) str))
- )
- (progn
- (if (getvar "secureload") (setvar "secureload" 0))
- (setq str (vl-string-right-trim ""\) " str))
- (while (setq nn (vl-string-position 34 str)) ;(ascii """) = 34
- (setq str (substr str (+ nn 2)))
- )
- (while (vl-string-search "\r\n" str)
- (setq str (vl-string-subst "" "\r\n" str))
- )
- (setq str (vl-filename-directory (vl-string-translate "/" "\" str)))
- )
- (progn
- (setq cadver(substr (getvar"ACADVER") 1 4))
- ;添加文件路径程序
- (setq dfg '(getenv "acad"))
- (vl-load-com)
- (setq var (vlax-get (setq tmp (vlax-get (vlax-get (vlax-get-acad-object)"Preferences") "Files")) "SupportPath"))
- (if (= (member " " dfg) nil)
- (vlax-put tmp "SupportPath" (strcat (strcat str "\\系统;") var)));添加当前lisp路径到文件搜索路径
- )
- )
- (and html (vlax-release-object html))
- (princ)
- )
- nil
- )
- (princ)
|