https://www.youtube.com/watch?v=gVUvnSJ-t3M
Documentations of functions:
https://docs.blender.org/api/2.81/bpy.ops.mesh.html
Use text editor to add main code
import bpy
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)
bpy.ops.mesh.primitive_monkey_add(location=(0,0,0))
- Set up the 'info' tab in the right window
- Make actions by hand
- Note the change of code and copy that
bpy.ops.object.shade_smooth()
`from random import randint number = 600 for i in range(0,number): x = randint(-20,20) y = randint(-20,20) z = randint(-20,20) bpy.ops.mesh.primitive_monkey_add(location=(x,y,z))
`
Functions help:
https://docs.blender.org/api/2.81/bpy.ops.mesh.html
bpy.ops.mesh.primitive_cylinder_add(radius=0.0105, depth = 0.022, enter_editmode=False, location=(0,0,0.045))
bpy.ops.mesh.primitive_cube_add(size = 0.012, enter_editmode=True, location=(0, 0, 0.055))
- add radians function
from math import radians
- Rotate using radians(90)
bpy.ops.mesh.primitive_cylinder_add(radius=0.0025, depth = 0.022, enter_editmode=False, location=(0,0,0.015), #align='VIEW', rotation=(0,radians(90),0))
Example1.
Adding cylinder on top of another cylinder:
- location Z =
-- sums of depth of previous cylinder -- plus 1/2 of the depth of the new cylinder