How to create an empty in Blender 2.57?

Hi there

Like the title says i m looking for the method to create emptys using python in 2.57.
In 2.49 the line was:


empty = Blender.Object.New('MyEmpty','Empty')

How I do that in Blender 2.57?

http://www.blender.org/documentation/blender_python_api_2_57_release/bpy.ops.object.html?highlight=object.add#bpy.ops.object.add

bpy.ops.object.add(type='EMPTY') # shortest form.

# longest
bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))

directly after adding the object, you can check the name it was given

>>> bpy.context.active_object.name
# should display some default name

you can force a new name

>>> bpy.context.active_object.name = 'yourEmpty'
>>> bpy.context.active_object
bpy.data.objects["yourEmpty"]

you can use the info window to report the python commands that you use, simply change one of your windows (for instance a TextEditor window to the type ‘Info’ ) and you will see a gray reporting area like .


dunno why the below attachment is borked…

Attachments


Thanks for the hint.
:smiley: