lsp支持文件搜索路径
本帖最后由 qmqyqj 于 2016-4-8 21:19 编辑我刚接触lsp没多久,想通过lsp实现自动给CAD添加 文件搜索路径,查了好多资料,没办法解决
下面的连接是在别的论坛看到的,但搞不明白怎么使用,希望得到指点一二
http://bbs.xdcad.net/forum.php?mod=viewthread&tid=517620
这是论坛的代码,但我加载就提示 “错误: no function definition”
;;; (xl_addsupportpath dir pos)
;;;添加文件夹到 AUTOCAD 支持搜索路径中的指定位置
;;; dir 为路径, pos 为数值 0 或正整数。
;;; pos 为 0 时添加支持搜索路径到最后,为 2 时添加支持搜索路径到第二项。
;;; 示例 (xl_addsupportpath "c:\\myfolder" 2) 返回修改后的支持搜索路径。
(defun xl_addsupportpath
(dir pos / tmp tmp1 tmp1_l tmp2 tmp3 str str_l)
(setq dir (strcat dir ";"))
(setq tmp1 (getenv "ACAD"))
(setq tmp1_l (strlen tmp1))
(setq str tmp1)
(if (= pos 0)
(setq tmp (strcat tmp1 ";" dir))
(progn
(if (= pos 1)
(setq tmp (strcat dir tmp1))
(progn
(setq str
(repeat pos
(setq str (substr (xl_strmemb ":" str) 2))
) ;_ 结束repeat
) ;setq str
(setq str_l (strlen str))
(setq tmp2 (substr tmp1 1 (- tmp1_l str_l 2))
tmp3 (substr tmp1 (- tmp1_l str_l 1) 2)
tmp(strcat tmp2 dir tmp3 str)
) ;setq
) ;progn
) ;if
) ;progn
) ;if
(setenv "ACAD" tmp)
;;;(princ)
) ;defun xl_addsupportpath ;;; 示例 (xl_addsupportpath "c:\\myfolder" 2) 返回修改后的支持搜索路径。 缺少函数 看不懂!!感觉好厉害 也缺少子函数 xl_strmemb,是个伪源码 没看懂,好厉害
页:
[1]