明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1510|回复: 2

[提问] 用秋枫老大的程序打包为何不能添加到搜索支持路径?

[复制链接]
发表于 2016-3-3 07:57:52 | 显示全部楼层 |阅读模式
CAD为2014、2016版,用下文代码为何不能添加搜索支持路径?请各位老大指正啊.


  1. (defun InitCttApplication (/
  2.                            GetMyApplicationPath GetCttPath
  3.                            strParse             StrUnParse
  4.                            Ctt_AddSupportPath   Load_CttMenu
  5.                            ctt_placemenu
  6.                            Ctt_cmdecho_save
  7.                           )

  8.   (defun GetMyApplicationPath (AppID)
  9.     (vl-registry-read
  10.       (strcat
  11.         "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\"
  12.         AppID
  13.         "_is1"
  14.       )
  15.       "Inno Setup: App Path"
  16.     )
  17.   )


  18.   (defun GetCttPath ()
  19.     (GetMyApplicationPath "SCAD")
  20.   )


  21.   (defun strParse (Str Delimiter / SearchStr StringLen return n char)
  22.     (setq SearchStr Str)
  23.     (setq StringLen (strlen SearchStr))
  24.     (setq return '())
  25.     (while (> StringLen 0)
  26.       (setq n 1)
  27.       (setq char (substr SearchStr 1 1))
  28.       (while (and (/= char Delimiter) (/= char ""))
  29.         (setq n (1+ n))
  30.         (setq char (substr SearchStr n 1))
  31.       ) ;_ end of while
  32.       (setq return (cons (substr SearchStr 1 (1- n)) return))
  33.       (setq SearchStr (substr SearchStr (1+ n) StringLen))
  34.       (setq StringLen (strlen SearchStr))
  35.     ) ;_ end of while
  36.     (reverse return)
  37.   ) ;_ end of defun


  38.   (defun StrUnParse (Lst Delimiter / return)
  39.     (setq return "")
  40.     (foreach str Lst
  41.       (setq return (strcat return Delimiter str))
  42.     ) ;_ end of foreach
  43.     (substr return 2)
  44.   ) ;_ end of defun
  45.       
  46.   (defun Ctt_AddSupportPath (PathToAdd isFirst / supportlist)
  47.     (if (not
  48.           (vl-string-search
  49.             (strcase (strcat pathToAdd ";"))
  50.             (strcase (strcat (getenv "ACAD") ";"))
  51.           )
  52.         )                              
  53.       (progn
  54.         (setq supportlist (strparse (getenv "ACAD") ";"))
  55.         (setq supportlist
  56.                (vl-remove-if-not
  57.                  'vl-file-directory-p
  58.                  supportlist
  59.                )
  60.         )                           
  61.         (if isFirst
  62.           (setq supportlist (cons PathToAdd supportlist))
  63.           (setq supportlist (append supportlist (list PathToAdd)))
  64.         )
  65.         (setenv "ACAD" (strUnParse supportlist ";"))
  66.       )
  67.     )
  68.   )


  69. (defun Load_CttMenu (/ acadver)
  70.     (setq acadver (atof (getvar "acadver")))
  71.     (cond
  72.       ((and (>= acadver 15.0) (< acadver 16.0))
  73.        (command "_menuload" "ST.mns")
  74.       )
  75.       ((and (>= acadver 16.0) (<= acadver 16.1))
  76.        (command "_menuload" "ST04.mns")
  77.       )
  78.       ((>= acadver 16.2) (command "_menuload" "ST06.mns"))
  79.     )
  80.   )


  81.   (defun ctt_placemenu (/ n)
  82.     (if (menugroup "SHIPTools")
  83.       (progn
  84.         (setq n 1)
  85.         (while (< n 24)
  86.           (if (menucmd (strcat "P" (itoa n) ".1=?"))
  87.             (setq n (+ n 1))
  88.             (progn
  89.               (if (> n 3)
  90.                 (setq n (- n 2))
  91.                 (setq n 3)
  92.               )                         ;if

  93.               ;; (menucmd (strcat "p" (itoa n) "=+STools.pop4"))
  94.               ;; (menucmd (strcat "p" (itoa n) "=+STools.pop3"))
  95.               ;; (menucmd (strcat "p" (itoa n) "=+STools.pop2"))
  96.               (menucmd (strcat "p" (itoa n) "=+STools.pop1"))
  97.               (setq n 25)
  98.             )                           ;progn
  99.           )                             ;if
  100.         )                               ;while
  101.       )                                 ;progn
  102.     )                                   ;if
  103.     (princ)
  104.   )

  105. ;;; -----------------------------------------------------
  106. ;;; main:
  107. ;;; -----------------------------------------------------
  108.   (setq Ctt_cmdecho_save (getvar "cmdecho"))
  109.   (setvar "cmdecho" 0)


  110.   (Ctt_AddSupportPath (GetCttPath) nil)
  111.   (Ctt_AddSupportPath (strcat (GetCttPath) "\\Program") nil)


  112.   (if (not (menugroup "STools"))
  113.     (Load_CttMenu)
  114.   )

  115.   (ctt_placemenu)

  116.   (setvar "cmdecho" Ctt_cmdecho_save)
  117.   (setq Ctt_cmdecho_save nil)

  118.   (princ "\n……加载 SCAD工具箱 v1.0……\n")

  119. ) ;_end of defun initCttApplication

  120. (initCttApplication)

  121. (load "SLayer.lsp")
  122. (load "STools.lsp")

  123. (princ)

  124. ;;; -----------------------------------------------------
  125. ;;; other:
  126. ;;; -----------------------------------------------------

本帖子中包含更多资源

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

x
发表于 2016-3-3 08:23:42 | 显示全部楼层
你要去试着看懂代码, ......
 楼主| 发表于 2016-3-3 10:59:20 | 显示全部楼层
jltx123456 发表于 2016-3-3 08:23
你要去试着看懂代码, ......

搞定了。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-20 19:45 , Processed in 0.303773 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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