您的位置:网站首页 > CAD教程 > CAD教程文章

加载lsp同时将lsp文件所在路径添加至cad搜索支持目录

时间:2011-11-27 07:32:59 来源:未知

;;lyy 支持appload加载、命令行(load "xx")加载和直接拖曳加载

(vl-load-com)
(defun set_path (/ str n1 n2)
(while (/= 0 (getvar "cmdactive")) (command))
(princ "n")
(setq str (getvar "lastprompt"))
(if (wcmatch (strcase str) "*(LOAD "*")
    (setq n1 (vl-string-search "(LOAD "" str)
          n2 (vl-string-search "")" str)
          str (substr str (+ n1 8) (- n2 n1 7))
    )
    (setq str
      (vl-registry-read "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*"
        (substr (vl-registry-read "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*" "MRUList") 1 1)
      )
    )
)
(setenv "ACAD" (strcat (getenv "ACAD") ";" (vl-filename-directory str)))
)
(set_path)
(setq set_path nil)