I want to create multiple primitives such as spheres via python, but my current approach is too slow:
import bpy
import time
t0 = time.time()
for i in range(400):
bpy.ops.mesh.primitive_ico_sphere_add(radius=0.5, location=[i * 10, 0, 0])
t1 = time.time()
dt = t1 - t0
print(dt)
This code takes about 5 seconds, which is just too slow (why?). Is there a way to make it run faster? I suspect creating the mesh every single iteration might be too slow and there is probably a better way to create multiples copies with the same shared mesh, but only different positions, which might be faster.
bpy.ops.object.duplicate_move_linked– HikariTW Mar 31 '20 at 06:17scene.objects.link(ob)change tocollection.objects.link(ob)for 2.8 – batFINGER Mar 31 '20 at 10:45