明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: hn10183051

[提问] 自动加载文件目录下的lsp、vlx和fas文件

[复制链接]
发表于 2019-10-23 18:18:18 | 显示全部楼层

load函数好像不支持arx文件吧?
发表于 2019-10-28 10:53:17 | 显示全部楼层
wyl219 发表于 2019-10-23 18:11
(defun wyl:autoloadlsp( / lst_fnm lst_dir i )
        (setq lst_dir (list "D:/_同步文件/CAD程序/lsp/lisp/ ...

可以先向注册表写入当前文件的路径,然后读取注册表使用
发表于 2019-10-28 11:52:08 | 显示全部楼层
qmqyqj 发表于 2019-10-28 10:53
可以先向注册表写入当前文件的路径,然后读取注册表使用

那怎么自动获取当前的路径呢?
发表于 2019-10-28 14:12:30 | 显示全部楼层
wyl219 发表于 2019-10-28 11:52
那怎么自动获取当前的路径呢?

;运行路径设置常数
(setq envstr(getenv "processor_architecture"))
   (if(vl-string-search "64" envstr)
      (setq X64 T)
      (setq X64 nil)
)
(vl-load-com)
(vl-catch-all-apply
'(lambda ( / nn str html)
  (while (= (logand (getvar "CmdActive") 1) 1) (command))
  (princ "\n")
  (command "_.copyhist")
  (and (setq html (vlax-create-object "htmlfile"))
       (setq str (vlax-invoke-method (vlax-get (vlax-get html 'parentwindow) 'clipboarddata) 'getdata "text")
             str (strcase (if (= (type str) 'variant) (vlax-variant-value str) str))
       )
       (progn
              (if (getvar "secureload") (setvar "secureload" 0))
          (setq str (vl-string-right-trim "\"\) " str))
          (while (setq nn (vl-string-position 34 str)) ;(ascii "\"") = 34
                (setq str (substr str (+ nn 2)))
          )
          (while (vl-string-search "\r\n" str)
                 (setq str (vl-string-subst "" "\r\n" str))
          )
          (setq str (vl-filename-directory (vl-string-translate "/" "\\"  str)))
       )
       (progn
          (setq cadver(substr (getvar"ACADVER") 1 4))
(setq rjlj (strcat str ))
        )
  )
  (and html (vlax-release-object html))
  (princ)
)
nil
)
(setq rjlj1 (strcat rjlj "\\"));路径后面加 \
(vl-registry-write "HKEY_CURRENT_USER\\Software\\yousheyun\\CAD""Path"  rjlj1 );路径写入注册表
(setq YSYlujin
(vl-registry-read "HKEY_CURRENT_USER\\Software\\yousheyun\\CAD""Path"));读取注册表路径并设置为路径变量


发表于 2021-10-30 21:21:16 | 显示全部楼层
感觉好难啊!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-16 12:48 , Processed in 0.169546 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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