明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: 曰微言薄论

[源码] 获取LSIP、FAS、VLX程序自身加载路劲

[复制链接]
发表于 2019-3-24 01:33 | 显示全部楼层
好用的,解决了我的问题。感谢楼主。
发表于 2019-3-24 21:47 | 显示全部楼层
一直在用旧版,很好用,可惜我的图框是外部参照,每次使用到要选一次,

请问最新 SmartBatchPlot 版本在哪里下载?能记住上次选的外部参照图框吗?
发表于 2019-3-25 15:22 | 显示全部楼层
小菜123 发表于 2018-12-6 09:40
(getvar "lastprompt")永远返回:"Command: (getvar \"lastprompt\")"
CAD2005

看来2005版还是用(command "_.copyhist")处理好些。
发表于 2019-12-23 12:56 | 显示全部楼层
(defun c:nx_jzcx ( / str1 nn str html adver    )

  (if (not (menugroup "念悬工具箱"))              
    (progn
(princ "\n程序正在加载中……");乱世江湖,只需一句不需愁

;acad也可以用lastprompt的方法的,这里只是展示_.copyhist的用法,但是浩辰无法用lastprompt
                   (setq
                     str1 (getvar "lastprompt")           ;获得最后一行命令
                     nn (vl-string-search "(LOAD \"" str1);在字符串中搜索指定子串
                   )
                   (if nn
(progn ;是执行
            ;字符串处理,得到完整路径:

                    (command "_.copyhist")
                     (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))
                     )

                    (setq str (vl-string-right-trim " " str))
                    (while (vl-string-search "\r\n" str)
                           (setq str (vl-string-subst "" "\r\n" str))
                    )

                    (while (setq nn (vl-string-search "(LOAD \"" str))
                           (setq str (substr str (+ nn 8)))
                    )

                    (and (setq nn (vl-string-search "\")" str))
                         (setq str (substr str 1 (1+ nn))) ;file name
                    )

                    (setq str (vl-filename-directory (vl-string-translate "/" "\\" str)))
                    (setq str ( strcat str "\\"))
                    (setq *nxljpa* str)
                    (and html (vlax-release-object html))
                );progn

  (progn
    (setq str (vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar "CPROFILE") "\\Dialogs\\Appload") "MainDialog"))
                    (setq *nxljpa* str)
    )

                   );if

;;********
  (setq adver (atof (getvar "acadver")))
(if(>= adver 19.1)
    (progn
(nx:tj_trustedpaths)
(nx:add_sfsp)
(nx:createnxgjx)
     )
    (progn
(nx:add_sfsp)
(nx:createnxgjx)
     )
)
;;********


)
)
  (princ)
);end
回复 支持 1 反对 0

使用道具 举报

发表于 2019-12-23 12:59 | 显示全部楼层
逛遍了明经与晓东,还是这个最靠谱
发表于 2020-2-24 01:28 来自手机 | 显示全部楼层
念悬工具箱 发表于 2019-12-23 12:59
逛遍了明经与晓东,还是这个最靠谱

确实 你这个获取路径应该是最完善的一个。
发表于 2022-10-4 21:33 | 显示全部楼层
很厉害!非常有借鉴意义
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-29 08:07 , Processed in 0.164949 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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