添加当前文件路径到搜索路径只能拖拽不能AP加载
本帖最后由 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)
因为ap加载获取不到程序路径 本帖最后由 自贡黄明儒 于 2022-9-22 14:43 编辑
记得虾版写过,你可以找来对比一下。搜Shrimp
页:
[1]