Thanks, Michael, for jogging my memory on the Block_Record table. Of course it still doesn't answer the question why can't these blocks be deleted? It appears to me that when a drawing that contains blocks is inserted to a new drawing, then that block of the drawing is erased, any blocks that were inserted only once become "unreferenced" and can be deleted. BUT, those blocks that had been inserted more than once somehow do not have thier references reset.
Note the following....I started a new drawing; I inserted a drawing that contains 10 blocks, 2 of which have multiple insertions; I erase said block; I run (mypurge nil) and then run MP's code to list the references:
*Model_Space.ReferenceCount = 0
*Paper_Space.ReferenceCount = 0
*Paper_Space0.ReferenceCount = 0
8-X-11.ReferenceCount = 3
point.ReferenceCount = 10
There is absolutely no ploace that these blocks are inserted, and the drawing they are a part of HAS been removed, yet here the references remain......trying an entget on the owner of each reference returns this:
$ (setq blk (vla-item (vla-get-blocks *doc*) "point"))
#<VLA-OBJECT IAcadBlock 02014704>
_$ (setq blk (entget (vlax-vla-object->ename blk)))
((-1 . <Entity name: 400ebad0>) (0 . "BLOCK_RECORD") (330 . <Entity name: 40083c08>) (5 . "1C2") (100 . "AcDbSymbolTableRecord") (100 . "AcDbBlockTableRecord") (2 . "point") (360 . <Entity name: 400ebaf8>) (340 . <Entity name: 0>) (102 . "{BLKREFS") (331 . <Entity name: 400ebba0>) (331 . <Entity name: 400ebc08>) (331 . <Entity name: 400ebc30>) (331 . <Entity name: 400ebc58>) (331 . <Entity name: 400ebc80>) (331 . <Entity name: 400ebca8>) (331 . <Entity name: 400ebcd0>) (331 . <Entity name: 400ebcf8>) (331 . <Entity name: 400ebd20>) (331 . <Entity name: 400ebd48>) (102 . "}"))
_$ (setq blk1 (entget (cdr (assoc 331 blk))))
((-1 . <Entity name: 400ebba0>) (0 . "INSERT") (330 . <Entity name: 400ebb78>) (5 . "1DC") (100 . "AcDbEntity") (67 . 0) (100 . "AcDbBlockReference") (66 . 1) (2 . "point") (10 10.227 5.56124 12.497) (41 . 72.0) (42 . 72.0) (43 . 72.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
_$ (entget (cdr (assoc 330 blk1)))
nil
which says to me that the owner no longer exists, so how can it still be referencing it? Acad knows that there are really no references, as you can purge this block without problem. Is there someway we can force the Block_Record table to update without closing/opening the drawing?
Tim, at least we now know the WHERE......