Block IDs in Audit3dmFile text

I’m trying to scrub a large, bloated file with many blocks and layers. I’m using Audit3dmFile to export my object list, running a few text delimiters to sort objects by size, and then identifying the offending large-size objects in Rhino using their GUID and a script found here: Select Rhino objects by guid - #4 by maje90

It’s working fine, but since I cannot select objects that are within blocks I need to know which objects are nested within which blocks. The Audit file refers to some naming convention within blocks but doesn’t seem to make sense based on my file. It seems Rhino blocks are assigned an Integer ID but I cannot figure out the logic, see the screenshot in which objects are sorted in descending order by Bytes in the second column. I’ve counted down 22 blocks in the alphabetical list of the BlockManager, but that block doesn’t correspond with the numbers I’m seeing in the audit table.

How did Rhino assign which block in my file was block #22, and how can I relocate it in my massive file?

Hi Scott - what do you mean by this?
If you are looking to find out which objects are in block definition 22, the functions in Python should be able to help -

import Rhino
import scriptcontext as sc

idefs = sc.doc.InstanceDefinitions

if len(idefs) > 0:
    for idef in idefs:
        print idef.Name
        x = idef.GetObjects()
        for item in x:
            print item
            print str(item.MemoryEstimate()) + ' bytes'
            print str(item.Id) +'\n'

Something like that? but I am not sure I get what the goal is…


Thanks for the reply @pascal , I think I gave a bit too much background info and confused the question.

All I want to know is which one of the many blocks in my file is block #22. The BlockManager does not expose any sort of ID for blocks, and lists them alphabetically. Are they given ID numbers based on their alphabetical arrangement? If I create a new block that is halfway through the alphabet and therefore listed halfway down the line inside BlockManager, do all existing blocks receive new ID numbers?

Hi Scott - see if this does anything you like -

Block (1.0 KB)

You give it the number of the block definition and it tells you some stuff about that.

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"