Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- # This function will remove all objects from the scene before the script runs, just to be safe
- def clear_scene():
- objs = bpy.data.objects
- for o in objs:
- objs.remove(o, do_unlink=True)
- clear_scene()
- sz = 2
- extents = 8.0
- # Create a single cube and locate it at x=0, y=0 and z=1
- bpy.ops.mesh.primitive_cube_add(location=(0,0,1))
- # Add a sun lamp directly above cube on the grid.
- bpy.ops.object.light_add(type='SUN', radius=1.0, location=(0.0, 0.0, extents * 0.667))
- # Add an isometric camera above the grid.
- # Rotate 45 degrees on the x-axis, 180 - 45 (135) degrees on the z-axis.
- bpy.ops.object.camera_add(location=(extents * 1.414, extents * 1.414, extents * 2.121), rotation=(0.785398, 0.0, 2.35619))
- bpy.context.object.data.type = 'ORTHO'
- bpy.context.object.data.ortho_scale = extents * 7.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement