I'm trying to build an automatic renderer using Python, loading lots of OBJ files one-by-one and rendering the results.
I can load the files no problem, but because they are different sizes, I need to either: 1. Change the objects to the same size, or 2. Move the camera so the object fits
I can't seem to get either option to work!
Thus far, the best option seems perhaps to use bpy.ops.object.dimensions and then scale, but I can't seem to get the x/y/z dimensions out of object.
bpy.ops.view3d.view_all()fit the objects into viewport, but not camera view :( – CodeManX May 12 '14 at 10:03maxI get the errorTypeError: 'BPyOpsSubModOp' object is not iterable, and when I try to access the componentxI get the errorAttributeError: 'BPyOpsSubModOp' object has no attribute 'x'. – JeffThompson May 12 '14 at 11:27bpy.ops.objectin front ofdimensions. Once you import and the imported model is selectedbpy.context.active_object.dimensionswill be the dimensions of the active object. If the object isn't selected it may be easier to access it by name -bpy.data.objects['new import'].dimensions. – sambler May 13 '14 at 02:49ops,context, anddatabut your suggestion using the named object worked the trick! – JeffThompson May 13 '14 at 19:48