I am using the following code to rescale objects (to ~15) from a collection (Blender 3.4.)
Current_Dimension = max(obj.dimensions.x, max(obj.dimensions.y, obj.dimensions.z))
if Current_Dimension > 0:
New_Scale = 15 / Current_Dimension
obj.scale = (New_Scale, New_Scale, New_Scale)
It works perfectly on almost all objects in my collection except a few that do not rescale. I am guessing either the Current_Dimension is wrong, or it is 0 for some reason. Any help would be appreciated.