;; | ----------------------------------------------------------------------------- ;; | SS_SelectX ;; | ----------------------------------------------------------------------------- ;; | Function : Performs a selection set build across the specified drawing ;; | document. ;; | Arguments: ;; | 'doc' - Document (object) to check in. ;; | 'ssName' - Name to assign for selection set ;; | 'EStr' - Entity String to scan for ;; | 'LStr' - Layer Names to scan for ;; | 'BStr' - Block Names to scan for (if this parameter is given, EStr should be nil) ;; | Returns : 'ss' - ActiveX Selection Set object or nil, if none could be ;; | formed. ;; | Comments : ActiveX function ;; | Updated : January 24, 2004 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ----------------------------------------------------------------------------- (defun SS_SelectX ( doc ssName EStr LStr BStr / cnt cSS ss ssl FilterType FilterData ) (setq cSS (vla-get-SelectionSets doc)) (if (SS_IsDefined? ssName cSS) (SS_DeleteNamed ssName cSS) ) (setq cnt (- 0 1)) (if BStr (setq EStr nil) ) (if EStr (setq cnt (1+ cnt)) ) (if LStr (setq cnt (1+ cnt)) ) (if BStr (setq cnt (1+ cnt)) ) (setq ss (vla-add cSS ssName) FilterType (vlax-make-safearray vlax-vbInteger (cons 0 cnt)) FilterData (vlax-make-safearray vlax-vbVariant (cons 0 cnt)) cnt 0 ) (if EStr (progn (vlax-safearray-put-element FilterType cnt 0) (vlax-safearray-put-element FilterData cnt EStr) (setq cnt (1+ cnt)) )) (if LStr (progn (vlax-safearray-put-element FilterType cnt 8) (vlax-safearray-put-element FilterData cnt LStr) (setq cnt (1+ cnt)) )) (if BStr (progn (vlax-safearray-put-element FilterType cnt 2) (vlax-safearray-put-element FilterData cnt BStr) (setq cnt (1+ cnt)) )) (vla-select ss acSelectionsetAll nil nil FilterType FilterData) (setq ssl (vla-get-Count ss)) (if (> ssl 0) ss nil) )