Don't know if this is what you want but it's what I can ante up ...
(defun _GetBlockLimits ( block min_size / @GetName @GetObjectExtents @IniCollection @Legit @Main @Try @XY @Wazzup )
;;========================================================================
;;
;; _GetBlockLimits.lsp
;;
;; Get the block's limits and object counts.
;;
;; 2014 Michael Puckett
;;
;; Distilled from existing code for my old buddy Steve (cadmandu).
;;
;; As such there may be errors. Find 'em, report 'em or shaddup uface.
;;
;;------------------------------------------------------------------------
;;
;; Args:
;;
;; block ;; valid (activex) block, e.g. modelspace
;; min_size ;; the smallest object size to be considered valid
;;
;; Example:
;;
;; (_GetBlockLimits
;; (vla-get-modelspace
;; (vla-get-activedocument
;; (vlax-get-acad-object)
;; )
;; )
;; 300 ;; ignore anything smaller than a foot
;; )
;;
;; >> ( (3.44425e+006 1.24654+003) ;; min x & y
;; (3.57655e+006 5.1095e+007) ;; max x & y
;; 43 ;; objects counted
;; 9 ;; objects ignored
;; )
;;
;; (_GetBlockLimits
;; (vla-get-modelspace
;; (vla-get-activedocument
;; (vlax-get-acad-object)
;; )
;; )
;; 9.99e99 ;; ignore anything smaller than a vogon warship
;; )
;;
;; >> (
;; nil ;; no min
;; nil ;; or max
;; 0 ;; because 0 objects counted
;; 52 ;; all objects ignored
;; )
;;
;; Other notes:
;;
;; The block can be any valid (activex) block.
;; * It can be modelspace (usually the case).
;; * Said block can reside within a document opened via ObjectDBX
;; (how we use it).
;; * It could be paperspace, tho you would want to mod or delete the
;; @Legit function. It's currently set up to reject anything that
;; we wouldn't normally consider a 3D object as we use this to
;; determine the limits of 3D models for automagic x-referenceing
;; for given dwg limits.
;; * If you want to use this to determine the limits of x-references
;; attached to the current drawing just iterate the active document's
;; blocks collection, and if the block is an xref pass it to the
;; function (and then apply applicable transformation yada to the
;; result for scale, rotation and funky normals).
;;
;; /beer
;;
;;------------------------------------------------------------------------
(defun @Try ( try_statement / try_catch try_result )
(if
(vl-catch-all-error-p
(setq try_catch
(vl-catch-all-apply
(function
(lambda ( )
(setq try_result (eval try_statement))
)
)
)
)
)
(setq *try_errors* ;; lexical global
(cons
(list
try_statement
(vl-catch-all-error-message try_catch)
)
*try_errors*
)
)
)
try_result
)
(defun @GetName ( obj / name )
(@Try '(setq name (vla-get-name obj)))
(if name name "")
)
(defun @XY ( point )
(list (car point) (cadr point))
)
(defun @GetObjectExtents ( object / a b )
(@Try
'(progn
(vlax-invoke-method object 'GetBoundingBox 'a 'b)
(mapcar 'vlax-safearray->list (list a b))
)
)
)
(defun @IniCollection ( collection )
(if (null (member collection *ini_collections*)) ;; lexical global
(progn
(vlax-for obj collection (princ))
(setq *ini_collections* (cons collection *ini_collections*))
)
)
collection
)
(defun @Legit ( obj min_size / objname )
;; filter out non model, non essential, non visible objects
;;
;; edit to suit, this works for my applications
(not
(or
(member
(setq objname (strcase (vla-get-objectname obj)))
'( "ACDBPOINT"
"ACDBTEXT"
"ACDBMTEXT"
"ACDBLEADER"
"ACDBWIPEOUT"
"ACDBATTRIBUTE"
"ACDBHATCH"
"ACDBATTRIBUTEDEFINITION"
"ACDBOLE2FRAME"
)
)
(wcmatch objname "ACDB*DIMENSION")
(and
(eq "ACDBBLOCKREFERENCE" objname)
(or
;; it's an AutoPLANT intel node
(member
(strcase (@GetName obj))
'("AT_MASTER_PIPING" "AT_MASTER_EQUIP")
)
;; it's an xref
(vlax-property-available-p obj 'path)
)
)
(and
(vlax-property-available-p obj 'length)
(@Try '(< (vlax-get obj 'length) min_size))
)
(and
(vlax-property-available-p obj 'diameter)
(@Try '(< (vlax-get obj 'diameter) min_size))
)
(and
(vlax-property-available-p obj 'visible)
(@Try '(eq :vlax-false (vla-get-visible obj)))
)
)
)
)
(defun @Wazzup ( obj / bb )
;; Note: Uses many lexical globals:
;; min_size, x*, y*, count, ignored
(if
(and
(@legit obj min_size)
(setq bb (@GetObjectExtents obj))
(< min_size (apply 'distance (mapcar '@XY bb)))
)
(setq
;; x* / y* are lexical globals
x* (append x* (mapcar 'car bb))
y* (append y* (mapcar 'cadr bb))
)
;; don't count objects without a bounding box
(setq
count (1- count)
ignored (1+ ignored)
)
)
)
(defun @Main ( block min_size / x* y* count ignored )
(setq
count (vla-get-count block)
ignored 0
)
(vlax-map-collection (@IniCollection block) '@Wazzup)
(if (zerop count)
(list
nil
nil
count
ignored
)
(list
(list (apply 'min x*) (apply 'min y*))
(list (apply 'max x*) (apply 'max y*))
count
ignored
)
)
)
(@Main block min_size)
)
Cheers.