贴子浮出了水面,证明还有些朋友关心,那就将有关函数贴上:- ;;;=======================================================================
- ;;; 检查字符串CMD是不是CAD内置命令、"acad.pgp"文件中定义过的命令简写、CAD内置函数之一, 如是返回T, 否nil.
- ;| Ex:
- (xxx-get-pgp "mi") ==> T
- (xxx-get-pgp "mirror") ==> T
- (xxx-get-pgp "XXX") ==> T ;已经加载了C:XXX函数。
- (xxx-get-pgp "car") ==> T
- (xxx-get-pgp "123wer") ==> nil
- |;
- (defun xxx-get-pgp (cmd / f_n o_p str rtn )
- (if (and (= (type cmd) 'STR)
- (or (<= 48 (ascii cmd) 57) (<= 65 (ascii cmd) 90) (<= 97 (ascii cmd) 122)
- (= (ascii cmd) 45) (= (ascii cmd) 95)) ;"-"、"_"、
- (setq f_n (findfile"acad.pgp"))
- (setq o_p (open f_n "r"))
- )
- (progn
- (while (and (setq str (read-line o_p))
- (or (= str "") (= (substr str 1 1) " ") (wcmatch str ";*")
- (not (wcmatch (strcase str) (strcat (strcase cmd) "`,*`**")))
- )))
- (if (and str (wcmatch (strcase str) (strcat (strcase cmd) "`,*`**")))
- (setq rtn t)
- (setq rtn nil)
- )
- (if o_p (close o_p))
- )
- (setq rtn nil)
- )
- (cond
- (rtn (princ (strcat "\n函数名"" CMD ""\t与ACAD.PGP中命令的简写重名了;")))
- ((or (= (eval (read (strcat "(type c:" cmd ")"))) 'SUBR)
- (= (eval (read (strcat "(type c:" cmd ")"))) 'USUBR)
- )
- ; (princ (strcat "\n函数名"C:" CMD ""\t已定义,并已加载到系统了;"))
- (setq rtn t)
- )
- ((getcname cmd)
- (princ (strcat "\n"" CMD ""\t是CAD系统内置命令;"))
- (setq rtn t)
- )
- ((member (strcase CMD) (atoms-family 1))
- (princ (strcat "\n"" CMD ""\t是CAD系统内置函数;"))
- (setq rtn t)
- )
- (T (setq rtn nil))
- )
- rtn)
- ;;;=======================================================================
|