Skip to content

Instantly share code, notes, and snippets.

@Muffo Muffo/
Last active Aug 29, 2015

What would you like to do?
Blender scene manipulation and rendering with Python
import math
import bpy
# Replace with the correct object name
object =["Surface"]
scene =['Scene']
# Set the resolution of the output image (this does not work)
# scene.render.resolution_x = 1920
# scene.render.resolution_y = 1080
# Movement
start_angle = 0
end_angle = 360
step_angle = 30
start_location = -2
# Obtain the radius of the cylinder
assert(object.scale[0] == object.scale[1], "Radius is not correct")
radius = object.scale[0]
# Generate the sequence of images
for cur_angle in range(start_angle, end_angle, step_angle):
object.rotation_euler[2] = cur_angle
object.location[0] = radius * math.radians(cur_angle) + start_location
# The format of the image must be defined in the GUI
scene.render.filepath = 'C:\\Users\\grandian\\Desktop\\render\\image_%d.bmp' % (cur_angle)
bpy.ops.render.render( write_still=True )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.