;;加载lsp同时将lsp文件所在路径添加至cad搜索支持目录 ;;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) (princ) 我用AutoCAD2007的工具->加载应用程序 后出现“错误: 参数类型错误: stringp nil” 的错误,不能实现它的功能:加载lsp同时将lsp文件所在路径添加至cad搜索支持目录。但直接把上面的lsp文件拖曳到CAD时能正常运行,请高手解答! |