I have found an answer in this stackexchange website that is supposed to do exactly this:
for area in bpy.context.screen.areas: if area.type == 'VIEW_3D': override = bpy.context.copy() override['area'] = area bpy.ops.view3d.view_selected() break
assuming a model imported from an
*.obj file is selected now. When I run it, nothing happens. However,
Shift-C + OpenGL Render does pretty much what I need.
The context: I need to render many models from many viewpoints, but all models have different scale, so I wonder if there is a command that could move camera so that object regardless of its original size fits given specific viewpoint, like, direction in spherical or cylinder coordinates, for example.
view_all() seem to do that.