A couple of things come to mind:
- Anonymous block names are dynamic. Just because it is named "*U566" in this session, does not mean that will be it's name in the next session
- The 64 bit in the DXF code 70 flag in the BLOCK table definition is a flag for referenced BLOCKs
- I would collect the unreferenced BLOCK names in a list for a purge command
At the command line ( a2k )
Command: _.purge
Enter type of unused objects to purge
[Blocks/Dimstyles/LAyers/LTypes/Plotstyles/SHapes/textSTyles/Mlinestyles/All]: _b
Enter name(s) to purge <*>: *U566
Verify each name to be purged? [Yes/No] <Y>: _n
Deleting block "*U566".
1 block deleted.
Something like this maybe:
(foreach b bl
(command "_.PURGE" "_Block" b "_No"))
You may have to run this multiple times due to block nesting. I would issue a QSAVE between each inteneration in order to reset DBMOD to 0
For final and full purge I use this:
(defun c:pas ()
(command "_.ZOOM" "_C" "" "")
(while (> (getvar "DBMOD") 0)
(command "_.QSAVE"
"_.PURGE" "_All" "*" "_No"))
(command "_.AUDIT" "_Yes")
(command "_.QSAVE")
(prin1))
-David