Python question - hopefully simple

(harkyman) #1

I asked this in the Python forum but got no response, so I’ll try it here.

Is there any way to duplicate an existing Blender mesh object, material settings and all, with Python (Creator 2.23)? From other OO stuff I’ve worked on, it seems to me that this should be some pretty rudimentary functionality, but it’s driving me nuts. I’ve spent four days searching the web, digging through the docs, trying every trick I can think of, but nothing works.

Please oh please tell me that I’m just being stupid and the solution is simple.

(theeth) #2

You can copy mesh or material data, but you cannot copy an object. Not without going through good trouble.

here an example code that copy the data from one object to another.

ob1 = Blender.Object.Get("object 1")
ob2 = Blender.Object.Get("object 2")
for prop in dir(ob1):
                exec("ob1." + prop + " = ob2." + prop")


(harkyman) #3

Beautiful. Thank you. This will work well.