How to Calculate Matrix_World Bounding Box Size of Instance Collection?

So, I recently found out on this forum that an instance collection is merely an EMPTY object with an instance_type of COLLECTION.

Because of this, blender does not appear to properly report a bounding box size. It simply returns the object’s origin as a bounding box size, because an EMPTY cannot have physical dimensions.

Because of this, I do not know how to calculate the bounding box size of a collection.

I thought about calculating the bounding box size of each object inside of the instance collection, but that seems like it can get very hairy very quickly if the instance collection is nesting more instance collections, and I find it difficult to wrap my mind around concepts like that.

Does anyone know how to easily, and quickly calculate matrix_world bounding box size of an instance collection?

I’d prefer for the script to return a list of corner vectors similar to this:

[
Vector((101.84539794921875, -10.669262886047363, -10.472915649414062)), 
Vector((101.84539794921875, -10.669262886047363, 17.25544548034668)), 
Vector((101.84539794921875, 17.059097290039062, 17.25544548034668)), 
Vector((101.84539794921875, 17.059097290039062, -10.472915649414062)), 
Vector((129.57376098632812, -10.669262886047363, -10.472915649414062)), 
Vector((129.57376098632812, -10.669262886047363, 17.25544548034668)), 
Vector((129.57376098632812, 17.059097290039062, 17.25544548034668)), 
Vector((129.57376098632812, 17.059097290039062, -10.472915649414062))
]

Edit: Fellow member Floatharr suggested temporarily “making instances real” so that the bounding box size could be calculated.

If this could be achieved from a BMESH level, it would be fairly quick I think? Sounds hacky, but it seems like it should work in theory. Still not sure where to begin, so any help would be appreciated. :slight_smile:

Thanks!