I got a .blend file where I got a simple cube and a plane. The Cube has some attributes like being a rigid body etc.
Now I let this cube fall on to the plane and then render an Image. This is my code:
scene = bpy.context.scene
cam = bpy.data.objects['Camera']
obj = bpy.data.objects['Cube']
scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = '/path/testImage.png'
scene.render.resolution_x = 640
scene.render.resolution_y = 640
scene.frame_set(scene.frame_end)
bpy.ops.render.render(write_still = True)
I would like to exchange the cube-object with another object coming from an .stl file. So loading this stl object and having it instead of the cube but with the same attributes that I set to the cube and at the same position.
How can I do this?
context.selected_objectsone of which iscontext.objectMakingobj.data = context.object.dataafter import will give cube above mesh of imported object. It will naff materials tho. – batFINGER Jan 28 '20 at 11:21