The following routine fails on the call to vla-getboundingbox when the document is an objectdbx doc. It works fine on the activedocument.
Suggestions are appreciated.
Mike
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Routine: GetXRefExtents ;;;
;;; Purpose: Get all xrefs references with names matching a wcmatch mask ;;;
;;; Arguments: Doc - document object, may e an objectdbx document. If doc is nil, the active ;;;
;;; document is used. ;;;
;;; NameMask - string, a wcmatch wildcard match to limit the blockrefs returned. ;;;
;;; Returns: A nested list where each sub-list consists of the following: car is the name of ;;;
;;; the blockref, cadr xref path, caddr is the lowerleft point of the blockref ;;;
;;; bounding box and cadddr is the upper right of the blockref bounding box. Points;;;
;;; returned are in the world coordinate system. ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This routine does not work on objectdbx documents:-( the call to vla-getboundingbox ;;;
;;; returns "Automation Error. Null extents". ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun GetXRefExtents (doc NameMask / rtlist blocks bname ll objblock ur)
(if doc
nil
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
)
(vlax-for blk (setq blocks (vla-get-blocks doc))
(vlax-for obj blk
(if (and (= "AcDbBlockReference" (vla-get-objectname obj))
(= :vlax-true
(vla-get-isxref
(setq objBlock (vla-item blocks (setq bname (vla-get-name obj))))
)
)
(wcmatch (strcase bname) NameMask)
(not[color=red]
(vl-catch-all-error-p
(vl-catch-all-apply 'vla-getboundingbox (list obj 'LL 'UR))
)[/color]
)
)
(setq
rtlist (cons
(list
(vla-get-name obj)
(vla-get-path objblock)
(vlax-safearray->list LL)
(vlax-safearray->list UR)
)
rtlist
)
)
)
)
)
rtlist
)