这是AutoCAD 2004 内置的 ai_utils.lsp文件中的一个函数.
我不明白以下几点:
1.该函数具体是做说明用的;
2.参数table name代表什么;
3.用到的 xstrcase 函数是干什么的.
下面是程序内容:
;;; (ai_table <table name> <bit> ) ;;; ;;; Returns a list of items in the specified table. The bit values have the ;;; following meaning: ;;; 0 List all items in the specified table. ;;; 1 Do not list Layer 0 and Linetype CONTINUOUS. ;;; 2 Do not list anonymous blocks or anonymous groups. ;;; A check against the 70 flag for the following bit: ;;; 1 anonymous block/group ;;; 4 Do not list externally dependant items. ;;; A check against the 70 flag is made for any of the following ;;; bits, which add up to 48: ;;; 16 externally dependant ;;; 32 resolved external or dependant ;;; 8 Do not list Xrefs. ;;; A check against the 70 flag for the following bit: ;;; 4 external reference ;;; 16 Add BYBLOCK and BYLAYER items to list. ;;; (defun ai_table (table_name bit / tbldata table_list just_name) (setq tbldata nil) (setq table_list '()) (setq table_name (xstrcase table_name)) (while (setq tbldata (tblnext table_name (not tbldata))) (setq just_name (cdr (assoc 2 tbldata))) (cond ((= "" just_name)) ; Never return null Shape names. ((and (= 1 (logand bit 1)) (or (and (= table_name "LAYER") (= just_name "0")) (and (= table_name "LTYPE") (= just_name "CONTINUOUS") ) ) )) ((and (= 2 (logand bit 2)) (= table_name "BLOCK") (= 1 (logand 1 (cdr (assoc 70 tbldata)))) )) ((and (= 4 (logand bit 4)) ;; Check for Xref dependents only. (zerop (logand 4 (cdr (assoc 70 tbldata)))) (not (zerop (logand 48 (cdr (assoc 70 tbldata)))))