2
Basic Object Operations Example
3
+++++++++++++++++++++++++++++++
4
This script demonstrates basic operations on object like creating new
5
object, placing it into scene, selecting it and making it active.
9
from mathutils import Matrix
11
scene = bpy.context.scene
13
# Create new lamp datablock
14
lamp_data = bpy.data.lamps.new(name="New Lamp", type='POINT')
16
# Create new object with our lamp datablock
17
lamp_object = bpy.data.objects.new(name="New Lamp", object_data=lamp_data)
19
# Link lamp object to the scene so it'll appear in this scene
20
scene.objects.link(lamp_object)
22
# Place lamp to a specified location
23
lamp_object.location = (5.0, 5.0, 5.0)
25
# And finally select it make active
26
lamp_object.select = True
27
scene.objects.active = lamp_object