明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1439|回复: 2

[讨论] 添加当前文件路径到搜索路径只能拖拽不能AP加载

[复制链接]
发表于 2019-8-5 22:44 | 显示全部楼层 |阅读模式
本帖最后由 qmqyqj 于 2019-8-12 11:10 编辑

可通过拖拽的方式将当前lisp程序的路径添加到支持的搜索目录,但通过AP加载的方式就不行,不知道什么原因造成的,希望有高手指点一下
  1. ;;添加当前文件路径
  2. ;;;运行路径设置常数
  3. (setq envstr(getenv "processor_architecture"))
  4.    (if(vl-string-search "64" envstr)
  5.       (setq X64 T)
  6.       (setq X64 nil)
  7. )
  8. (vl-load-com)
  9. (vl-catch-all-apply
  10. '(lambda ( / nn str html)
  11.   (while (= (logand (getvar "CmdActive") 1) 1) (command))
  12.   (princ "\n")
  13.   (command "_.copyhist")
  14.   (and (setq html (vlax-create-object "htmlfile"))
  15.        (setq str (vlax-invoke-method (vlax-get (vlax-get html 'parentwindow) 'clipboarddata) 'getdata "text")
  16.              str (strcase (if (= (type str) 'variant) (vlax-variant-value str) str))
  17.        )
  18.        (progn
  19.         (if (getvar "secureload") (setvar "secureload" 0))
  20.           (setq str (vl-string-right-trim ""\) " str))
  21.           (while (setq nn (vl-string-position 34 str)) ;(ascii """) = 34
  22.                 (setq str (substr str (+ nn 2)))
  23.           )
  24.           (while (vl-string-search "\r\n" str)
  25.                  (setq str (vl-string-subst "" "\r\n" str))
  26.           )
  27.           (setq str (vl-filename-directory (vl-string-translate "/" "\"  str)))
  28.        )
  29.        (progn
  30.           (setq cadver(substr (getvar"ACADVER") 1 4))
  31. ;添加文件路径程序
  32. (setq dfg '(getenv "acad"))
  33. (vl-load-com)
  34. (setq var (vlax-get (setq tmp (vlax-get (vlax-get (vlax-get-acad-object)"Preferences") "Files")) "SupportPath"))
  35. (if (= (member "  " dfg) nil)
  36. (vlax-put tmp "SupportPath" (strcat (strcat str "\\系统;") var)));添加当前lisp路径到文件搜索路径
  37. )
  38.   )
  39.   (and html (vlax-release-object html))
  40.   (princ)
  41. )
  42. nil
  43. )
  44. (princ)


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2022-9-22 14:39 来自手机 | 显示全部楼层
因为ap加载获取不到程序路径
发表于 2022-9-22 14:41 | 显示全部楼层
本帖最后由 自贡黄明儒 于 2022-9-22 14:43 编辑

记得虾版写过,你可以找来对比一下。搜Shrimp
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-25 16:31 , Processed in 0.530111 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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