How to change the name of a mesh ?

Hi all,

I’m just trying to change the name of a mesh :

obj.data.name = obj.name

But it doesn’t work. I think it would be better I use a function like “setName” but this function isn’t definied for Blender Meshes.

Any idea ?

Thanks :slight_smile:

Wetneb


from Blender import Window 
import bpy 
 
sce= bpy.data.scenes.active 
ob_act = sce.objects.active # assuming we have an active, might be None 
me = ob_act.getData(mesh=1)  
me.name = ob_act.name 
 
Window.RedrawAll()

Thanks a lot :slight_smile: .
I thought that “obj.data” was equal to “obj.getData(1)” when dealing with meshes objects.

obj.data is unfortunately only read-only data. I’m glad the snippet worked out for you. :slight_smile: