fork download
  1. import bpy
  2.  
  3. lista = []
  4. import random, math
  5. for _ in range(1000):
  6. alpha = random.random()*2*3.14
  7. r = random.random()*5 + 5
  8. angle_i = (random.random()-0.5)*0.05
  9. x = r * math.sin(alpha)
  10. y = r * math.cos(alpha)
  11. z = r * math.sin(angle_i)
  12. lista.append((x, y, z))
  13.  
  14.  
  15. bpy.ops.object.select_all(action='DESELECT')
  16. bpy.ops.mesh.primitive_ico_sphere_add(subdivisions=1, radius=0.05)
  17. sphere = bpy.context.object
  18.  
  19. for loc in lista:
  20. ob = sphere.copy()
  21. ob.location = loc
  22. #ob.data = sphere.data.copy() # uncomment this, if you want full copies and no linked duplicates
  23. bpy.context.collection.objects.link(ob)
  24.  
Runtime error #stdin #stdout #stderr 0.12s 23728KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ModuleNotFoundError: No module named 'bpy'