明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1821|回复: 4

lsp支持文件搜索路径

[复制链接]
发表于 2016-4-8 21:11 | 显示全部楼层 |阅读模式
5明经币
本帖最后由 qmqyqj 于 2016-4-8 21:19 编辑

我刚接触lsp没多久,想通过lsp实现自动给CAD添加 文件搜索路径,查了好多资料,没办法解决

下面的连接是在别的论坛看到的,但搞不明白怎么使用,希望得到指点一二
http://bbs.xdcad.net/forum.php?mod=viewthread&tid=517620

这是论坛的代码,但我加载就提示    “错误: no function definition”

  1. ;;; (xl_addsupportpath dir pos)
  2. ;;;添加文件夹到 AutoCAD 支持搜索路径中的指定位置
  3. ;;; dir 为路径, pos 为数值 0 或正整数。
  4. ;;; pos 为 0 时添加支持搜索路径到最后,为 2 时添加支持搜索路径到第二项。
  5. ;;; 示例 (xl_addsupportpath "c:\\myfolder" 2) 返回修改后的支持搜索路径。
  6. (defun xl_addsupportpath
  7.        (dir pos / tmp tmp1 tmp1_l tmp2 tmp3 str str_l)
  8.   (setq dir (strcat dir ";"))
  9.   (setq tmp1 (getenv "ACAD"))
  10.   (setq tmp1_l (strlen tmp1))
  11.   (setq str tmp1)
  12.   (if (= pos 0)
  13.     (setq tmp (strcat tmp1 ";" dir))
  14.     (progn
  15.       (if (= pos 1)
  16.         (setq tmp (strcat dir tmp1))
  17.         (progn
  18.           (setq        str
  19.                  (repeat pos
  20.                    (setq str (substr (xl_strmemb ":" str) 2))
  21.                  ) ;_ 结束repeat
  22.           )                                ;setq str
  23.           (setq str_l (strlen str))
  24.           (setq        tmp2 (substr tmp1 1 (- tmp1_l str_l 2))
  25.                 tmp3 (substr tmp1 (- tmp1_l str_l 1) 2)
  26.                 tmp  (strcat tmp2 dir tmp3 str)
  27.           )                                ;setq
  28.         )                                ;progn
  29.       )                                        ;if
  30.     )                                        ;progn
  31.   )                                        ;if
  32.   (setenv "ACAD" tmp)
  33. ;;;(princ)
  34. )                                        ;defun xl_addsupportpath

附件: 您需要 登录 才可以下载或查看,没有账号?注册
发表于 2016-4-25 15:43 | 显示全部楼层
;;; 示例 (xl_addsupportpath "c:\\myfolder" 2) 返回修改后的支持搜索路径。
回复

使用道具 举报

发表于 2016-10-8 17:37 | 显示全部楼层
缺少函数
回复

使用道具 举报

发表于 2021-10-31 16:45 | 显示全部楼层
看不懂!!感觉好厉害
回复

使用道具 举报

发表于 2023-11-5 21:39 | 显示全部楼层
也缺少子函数 xl_strmemb,是个伪源码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-25 10:03 , Processed in 0.235022 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表