How to add object dimension info to the header?

I’m not good at coding but can someone help me figure out how to do this?

That would be nice, but I don’t think you can do that.

This script will give this result but should be enough for your requirement. You can only add new items at the end or at the beginning afaik. If someone knows how to add in middle please ping me and let me know.

import bpy

def dimension_data(self, context):
        layout = self.layout

        obj = context.active_object
        x,y,z = obj.dimensions

        # Create a simple row.
        row = layout.row()
        row.label(text = "X : {0:.3f}".format(x))
        row.label(text = "Y : {0:.3f}".format(y))
        row.label(text = "Z : {0:.3f}".format(z))

def register():
    bpy.types.VIEW3D_HT_tool_header.append(dimension_data)

def unregister():
    bpy.types.VIEW3D_HT_tool_header.remove(dimension_data)

if __name__ == "__main__":
    try: 
        unregister()
    except:
        pass
    register()
1 Like