SOS ! How to export boundary boxes of meshes ?

Hello all,

is there an easy way to export only the boundary boxes of meshes ? or to replace complex meshes with their boundarx boxes ?

I looked in the API but did not find any function yet. I know that i can make loop through all vertices inside each mesh and use min, max values to create the boundary box myself. but I thought maybe there is a lazy way. my files have few hundreds or even thoundases of meshes.

any hint or code snippst is highly appreciated:)


import bpy

meshobs = [ob for ob in bpy.data.objects if ob.type == "MESH"]
print("There are %d mesh objects"%len(meshobjs))
for ob in meshobs:
    print("Obj:%s bounding box coords"%ob.name)
    for [x,y,z] in ob.bound_box:
        print(x,y,z)

you will need to multiply by the object’s matrix to get world locations i think.