马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
用于手动添加支持路径到当前配置,你所作的仅是任意指定一个工具箱目录下的文件(用于CAD2002)
- (defun c:addxdsoft (/ str-cut StrUnParse str-search
- $dir oldsup xdsoftpath newsupport
- )
- (defun str-cut (fa-str str how / len li no)
- (setq len (strlen str))
- (while (setq no (vl-string-search str fa-str))
- (if (/= no 0)
- (setq li (cons (substr fa-str 1 no) li))
- )
- (setq li (cons (substr fa-str (1+ no) len) li)
- fa-str (substr fa-str (+ no len 1))
- )
- )
- (if (/= "" fa-str)
- (setq li (cons fa-str li))
- )
- (if how
- (vl-remove str (reverse li))
- (reverse li)
- )
- )
- ;;相当xdrx_txtsrch
- ;;出现的位置
- ;;(str-search "12341234123456""12")-->(1 5 9)
- (defun str-search (fa-str str / a len li no)
- (setq len (strlen str)
- a 0
- )
- (while (setq no (vl-string-search str fa-str a))
- (setq li (cons no li)
- a (+ len no)
- )
- )
- (mapcar '1+ (reverse li))
- )
- ;;;==================================================================
- ;;; (StrUnParse Lst Delimiter)
- ;;; Parses a list of strings into 1 delemited string
- ;;;------------------------------------------------------------------
- ;;; Parameters:
- ;;; Str List to concantenate
- (defun StrUnParse (Lst Delimiter / return)
- (setq return "")
- (foreach str Lst
- (setq return (strcat return Delimiter str))
- ) ;_ end of foreach
- (substr return 2)
- ) ;_ end of defun
- (setq $dir (getfiled "选择晓东工具箱任意文件" "" "" 4))
- (setq oldsup (getenv "ACAD"))
- (if (and $dir
- (vl-string-search "XDSOFT" (strcase $dir))
- (/= (length (str-search (strcase oldsup) "XDSOFT")) 4)
- )
- (progn
- (if (str-search (strcase oldsup) "XDSOFT")
- (progn
- (setq tmplst (reverse (str-cut oldsup ";" t)))
- (while (str-search (strcase (car tmplst)) "XDSOFT")
- (setq tmplst (cdr tmplst))
- )
- (setq oldsup (strunparse (reverse tmplst) ";"))
- )
- )
- (setq
- xdsoftpath
- (strunparse
- (reverse
- (member "XDSOFT" (reverse (str-cut (strcase $dir) "\" t)))
- )
- "\"
- )
- newsupport (strcat oldsup
- ";"
- (strcat xdsoftpath "\\SYS;")
- (strcat xdsoftpath "\\LISP;")
- (strcat xdsoftpath "\\LIB;")
- (strcat xdsoftpath "\\BIN")
- )
- )
- (setenv "ACAD" newsupport)
- (if (not (menugroup "xdsoft"))
- (command ".menuload" "xdsoft")
- )
- (princ "\n成功添加 XDSoft 工具箱!")
- )
- (princ "\n不是工具箱目录文件!")
- )
- (princ)
- )
- (c:addxdsoft)
|