@Moshe-A wrote:
....
Are you sure this can be done without coping the block definition out to a new database document?
....
If what you want is just a list of Block definitions, including nested Blocks, that's easy, because nested Blocks' definitions are also in the Block table, which doesn't care about such things:
(while
(setq ins (cdadr (tblnext "block" (not ins))))
(setq inslist (cons ins inslist))
)
That returns a list of all Block definitions, nested or otherwise, and saves it to the 'inslist' variable. I assume you are not looking for something like a count, or something involving a user selection, because of your wanting Blocks that are not inserted to be included.
[It would also include Xrefs and Windows Metafiles, which are also "INSERT" objects, and old-style Hatch patterns (which you could filter out by removing ones with names starting with "*X"), and even dimensions (which you could filter out by their "*D" beginnings). At least it does in my ol' 2004, though some of that may have changed since.]
If you want something else, such as a distinction between which Blocks are top-level and which are nested, that's more complicated [or, it might not be possible -- a nested Block can also be inserted at top level independently of any Block definition in which it may also happen to be nested].
Or maybe you want something that lists which Block definitions are nested within which other Block definitions. I have something that will do that for a user-selected Block insertion, which could probably be modified to work through the Block table instead.
If I haven't described what you're really looking for, maybe you can describe more specifically what you would want to come out the other end of a routine.
Kent Cooper, AIA