martes, 3 de junio de 2014

Duplicate a serie of objects in blender 2.70 with python

import bpy

# Extracted from the Bret Battey blog:Bat Hat Media

# Find the objects with the text ".A." on its name,
# make a coy of everyone,
# change the text in copy for".B.",
# and select the new objects

scene= bpy.context.scene

for n in
    if (".A."))!= -1 :".A.");[0:pos]+".B."[pos+3:];
        mesh =;# Create new mesh
        ob_new =, mesh);# Create new object associated with the mesh
         # Copy data block from the old object into the new object =;
        ob_new.scale = copiedobject.scale;
        ob_new.location = copiedobject.location;
        ob_new.rotation_euler = copiedobject.rotation_euler;

        # Link new object to the given scene and select it;;
        print (," COPIED with name: ",newname);