- ;; Selection Set Bounding Box - Lee Mac
- ;; Returns a list of the lower-left and upper-right WCS coordinates of a
- ;; rectangular frame bounding all objects in a supplied selection set.
- ;; sel - [sel] Selection set for which to return bounding box
- (defun LM:ssboundingbox ( sel / idx llp ls1 ls2 obj urp )
- (repeat (setq idx (sslength sel))
- (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
- (if (and (vlax-method-applicable-p obj 'getboundingbox)
- (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'llp 'urp))))
- )
- (setq ls1 (cons (vlax-safearray->list llp) ls1)
- ls2 (cons (vlax-safearray->list urp) ls2)
- )
- )
- )
- (if (and ls1 ls2)
- (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list ls1 ls2))
- )
- )
|