This code should resize objects. It works great in 2.79, but not in 2.8.

I get this error:

AttributeError: 'bpy_prop_collection' object has no attribute 'dimensions'

This is my code, I can't find the error:


    dimX = bpy.context.scene.objects.dimensions.x
    dimY = bpy.context.scene.objects.dimensions.y
    dimZ = bpy.context.scene.objects.dimensions.z

    multiple = 5 / dimZ

    bpy.context.scene.objects.dimensions = (dimX * multiple, dimY * multiple, 5)
  • 1
    $\begingroup$ Are you trying to change the dimensions of every object? $\endgroup$ Commented Oct 25, 2019 at 20:48
  • $\begingroup$ FWIW I dispute the claim that the code posted works in any version. $\endgroup$
    – batFINGER
    Commented Nov 28, 2019 at 12:44

1 Answer 1


You're referring to multiple objects, which altogether have no attribute "dimensions". Each individual object has, though:

for obj in bpy.context.scene.objects: 
    dimX, dimY, dimZ = obj.dimensions
    multiple = 5/dimZ
    obj.dimensions = (dimX * multiple, dimY * multiple, 5)

Be aware that division by zero could be an issue. Also I'm not sure if all objects have dimensions (cameras?). You could add if obj.type != "MESH" or dimZ == 0: continue as the second line of your forloop.

  • 2
    $\begingroup$ or obj.dimensions *= multiple $\endgroup$
    – batFINGER
    Commented Nov 28, 2019 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .