;; | ----------------------------------------------------------------------------- ;; | SS_SSgetBlkAtt ;; | ----------------------------------------------------------------------------- ;; | Function : Does an ssget and applies Block Attribute Checks also ;; | Arguments: 'ss' - Selection Set of Blocks ;; | 'AttChk' - Attribute Xdata condition to check ;; | AttChk is in the form '('pos' 'operator' 'value') ;; | where ;; | 'pos' is the position of Attribute data (starts with 1) ;; | 'operator' is the equality check operator, can be either ;; | = or *. If the operator is =, a literal ;; | equality check is done else if it is a * ;; | a wildcard match (wcmatch) is performed. ;; | 'value' is the value to be checked ;; | 'RetFmt' Return Format ;; | 0 - Selection Set ;; | 1 - List containing (ename AttDataValue) ;; | ;; | Comment : This function is very similar to SSgetXD except that it ;; | uses a selection set of block INSERTs as input and the 'Operator' ;; | argument is modofied to accept only strings as applicable. ;; | Return : Selection set matching criteria ;; | Updated : 16 November, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ----------------------------------------------------------------------------- (defun SS_SSgetBlkAtt ( ss AttChk RetFmt / ss1 ssl cnt ename entl Att pos Operator value Lst ) (if (= RetFmt 0) (setq ss1 (ssadd)) (setq Lst '()) ) (if ss (progn (setq ssl (sslength ss) cnt 0 pos (nth 0 AttChk) Operator (nth 1 AttChk) value (nth 2 AttChk) ) (repeat ssl (setq ename (ssname ss cnt) Att (BL_GetAtts ename) cnt (1+ cnt) ) (if (and Att (setq Att (nth (1- pos) Att))) (progn (setq Att (strcase (nth 0 Att))) (cond ((= Operator "=") (if (= Att value) (progn (if (= RetFmt 0) (ssadd ename ss1) (setq Lst (cons (list ename Att) Lst)) ) )) ) ((= Operator "*") (if (wcmatch Att value) (progn (if (= RetFmt 0) (ssadd ename ss1) (setq Lst (cons (list ename Att) Lst)) ) )) ) ) )) ) )) (if (= RetFmt 0) (if (> (sslength ss1) 0) ss1 nil) Lst ) )