Change object.type

Hi,
Is there a simple way convert empty object type to mesh object? object.type seems to be read-only?

Yes, it’s read only. I haven’t looked at the documentation, but maybe one of the bpy.ops operators does what you need it to do? Otherwise consider either creating a mesh object at the location or parent a new mesh object to the empty, which may actually be the better solution.

Thanks for the reply. I was looking through API, but couldn’t find anything. Looks like creating new object is the only way.

The “convert to” operator does not support Empties:
bpy.ops.object.convert(target=‘MESH’)

But if the source object is an empty, why do you want to convert it to mesh anyway? To inherit the origin? Well, you could do that in a script easily:

import bpy

ob = bpy.context.object
assert ob.type == 'EMPTY'

name = ob.name
loc = ob.matrix_world.to_translation()
ob.name += "_old"
me = bpy.data.meshes.new(name)

scene = bpy.context.scene
scene.objects.unlink(ob)

ob = bpy.data.objects.new(name, me)
ob.location = loc

scene.objects.link(ob)
scene.update()
scene.objects.active = ob
ob.select = True

I had a lot of high poly dupli groups and wanted to replace them with low poly meshes which will inherit transformation matrix, groups, parent… So I thought there must be some way just to do change type of object instead of copying everything. I remembered later that I can just group low poly meshes in groups of one and change the dupli_group-s to the new groups (seems to be simplest, although I’ll have many useless groups).