;by MP
- (defun SSBoundingBox ( ss / _GetBoundingBox _SStoObjects _Main )
- (defun _GetBoundingBox ( object / p1 p2 )
- (vl-catch-all-apply
- '(lambda ( )
- (vlax-invoke-method
- object
- 'GetBoundingBox
- 'p1
- 'p2
- )
- )
- )
- (if p1
- ( (lambda (data)
- (mapcar
- '(lambda (funcs)
- (mapcar
- '(lambda (func)
- (apply func data)
- )
- funcs
- )
- )
- '( (caar cadar)
- (caadr cadar)
- (caadr cadadr)
- (caar cadadr)
- )
- )
- )
- (list
- (mapcar
- 'vlax-safearray->list
- (list p1 p2)
- )
- )
- )
- )
- )
-
- (defun _SStoObjects ( ss / i objects )
- (if (eq 'pickset (type ss))
- (repeat (setq i (sslength ss))
- (setq objects
- (cons
- (vlax-ename->vla-object
- (ssname ss
- (setq i (1- i))
- )
- )
- objects
- )
- )
- )
- )
- objects
- )
-
- (defun _Main ( ss / boundingboxes )
- (cond
- ( (setq boundingboxes
- (vl-remove-if 'null
- (mapcar '_GetBoundingBox
- (_SStoObjects ss)
- )
- )
- )
- (mapcar
- '(lambda ( func pair / lst )
- (list
- (apply (car pair)
- (mapcar 'car
- (setq lst
- (mapcar
- func
- boundingboxes
- )
- )
- )
- )
- (apply (cadr pair)
- (mapcar 'cadr lst)
- )
- )
- )
- '(car cadr caddr cadddr)
- '((min min)(max min)(max max)(min max))
- )
- )
- )
- )
-
- (_Main ss)
-
- )
|