1
$\begingroup$

Is it possible to render an image by calling the camera through a command with the text editor? I have a series of meshes that I want to upload into blender and take an picture one at a time. I want to upload the mesh, take a picture, delete the mesh and then upload the new mesh. I have my code to upload each mesh one at a time through a loop to create my mesh through faces and verts. I know the orientation and size that my meshes will be created. I have set up my lighting and camera angle that I want. I am using blender 2.82

$\endgroup$
1
$\begingroup$

Possible duplicate of: Rendering a cube as png file using Blender's Python API. (I would put this in a comment if I had enough reputation.)

The above answer includes the following, with the assumption your camera is already set up (note that I have not tested the code):

Set the render settings of the current scene, and render it. write_still is necessary if you want the result to be written to the filepath. There will be no visual feedback during the render process.

# render settings
scene = bpy.context.scene
scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = "F:/image.png"
bpy.ops.render.render(write_still = 1)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.