I have successfully made preview of blend 3D format. The /1/ below is my working script. Since customer has other formats, for example obj, Aveva made 3D format files. How could I make a conversion from obj or other format files to blend file format by python?
import bpy
import math
scn = bpy.context.scene
j=-1
for k in bpy.data.objects.keys():
if(k.startswith('Camera')):
j =k
break
print('j is: %s ', j)
cam = bpy.data.objects[j]
origin = bpy.data.objects.new('Empty',None)
step_count = 2
for step in range(0, step_count):
origin.rotation_euler[2] = math.radians(step * (360.0 / step_count))
scn.render.filepath = 'e:\\temp\\happy_shot_%d_wednes_Sep_7.png' % step
bpy.context.scene.render.resolution_x = 120
bpy.context.scene.render.resolution_y = 64
bpy.ops.render.render(write_still=True)
cam = scn.objects.get("Camera")
orsnc.camera
will be None if not existent in scene. $\endgroup$ – batFINGER Sep 20 '18 at 3:52