A little spin on VVA's
This is pretty much the extent that you can find out (afaik).
(princ "\nxref name status type path")
(while (setq d (tblnext "block" (null d)))
(setq grp70 (cdr(assoc 70 d)))
(if (=(logand grp70 4) 4)
(progn ;_Xref
(princ
(strcat "\n"
(cdr(assoc 2 d))
" "
(if (= (logand 8 grp70) 8) "overlay" "insert ")
" "
(if (eq 32 (logand 32 grp70))
(if (ssget "x" (list (cons 0 "INSERT")(assoc 2 d))) ;quick and easy
;from T. Willey's code at: http://www.theswamp.org/index.php?topic=4103.msg103206#msg103206
;more direct -> (if (and (vla-Item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-Acad-Object)))
; (cdr(assoc 2 d)))
; (assoc 71 (entget (tblobjname "block" (vla-get-Name i))))
; );and
"LOADED"
"UNREFERENCED/ORPHANED"
)
(if (findfile (assoc 1 d))
"UNLOADED"
"NOT FOUND")
)
" "
(cdr(assoc 1 d))
)
)
)
)
);_while
Well, I say that. You could differentiate between orphaned and unreferenced if you recurse through all xref's and their xref's bulding a list. If the nested list contains your xref from the first pass, then it's nested and thus orphaned. That is, if it was marked 'UNREFERENCED/ORPHANED' in the first place.
Here's lee-mac's rendition to get nested xref data, but does a NonNextedXrefList, so you would know it's orphaned if it's not in the list. Combining these two methods could generate that.
GetXrefNesting expects a vla-object doc.
(defun GetXrefNesting ( doc / GetXrefInfo Ent XrefList NonNestedXrefList )
(defun GetXrefInfo ( ent / NestList )
(foreach i (member '(102 . "{BLKREFS") (entget ent))
(if (equal (car i) 332)
(progn
(setq NestedList (cons (cdr i) NestedList))
(setq NestList
(cons
(cons
(cdr i)
(GetXrefInfo (cdr i))
)
NestList
)
)
)
)
)
NestList
)
;-------------------------------------------------------------------
(vlax-for i (vla-get-Blocks doc)
(if
(and
(equal (vla-get-IsXref i) :vlax-true)
(setq Ent (vlax-vla-object->ename i))
)
(setq XrefList
(cons
(cons
Ent
(GetXrefInfo Ent)
)
XrefList
)
)
)
)
(foreach i XrefList
(if (not (member (car i) NestedList))
(setq NonNestedXrefList (cons i NonNestedXrefList))
)
)
NonNestedXrefList
)