A while back I had a Rhinoscript that could (assuming the model was cleanly set up with this in mind, the blocks being all linked or linked/embedded) extract a summary of “parts” and “subassemblies.” To do so it had to actually open up all the block source files to count the nested blocks, and open them up, etc.
I’m rewriting it in Python and wondering if it’s at all possible to do so while only looking at the top-level model? It seems not. If I find all the instance definitions that are children of a block and recursively find the children of those blocks(mostly using rs.BlockContainers, also using GetObjects on the instance definitions,) blocks nested 2+ layers below get counted again and again, I guess once for every parent up the chain. Of course I can’t just assume the extra blocks are superfluous, they could be present at more than one level, unless I could somehow test…something? Maybe the fact that InstanceDefinition.UsesDefinition and check the nest level returned?
I suppose almost any amount of complex tedious checking would be far faster than opening up every file, if an iron-clad logic exists.