Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- from itertools import product
- from mathutils import Vector
- def duplicateObject(scene, name, copyobj):
- # Create new mesh
- mesh = bpy.data.meshes.new(name)
- # Create new object associated with the mesh
- ob_new = bpy.data.objects.new(name, mesh)
- # Copy data block from the old object into the new object
- ob_new.data = copyobj.data.copy()
- ob_new.scale = copyobj.scale
- ob_new.location = copyobj.location
- # Link new object to the given scene and select it
- scene.objects.link(ob_new)
- ob_new.select = True
- return ob_new
- print(bpy.context.scene.objects.active)
- orig = bpy.context.scene.objects.active
- for x in range(0,9):
- for y in range(0,9):
- for z in range(0,9):
- loc = orig.location + Vector([x*0.1,y*0.1,z*0.1])
- ob = duplicateObject(bpy.context.scene, "Cube", orig)
- print(str(x) + " " + str(y) + " " + str(z))
- print(ob)
- ob.location = loc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement