Blender Python Examples

Blender Python Generate 50 cubes at random positions.


import bpy
from random import randint

for i in range(50):
    bpy.ops.mesh.primitive_cube_add(
        location = [randint(-10, 10) for axis in 'xyz']
    )




Generate cubes that follow a sin curve.

import bpy
from math import sin

for i in range(50):
    x, y, z = 0, i, sin( i )
    bpy.ops.mesh.primitive_cube_add(
        location = [ x, y, z ]
    )


Comments

Popular posts from this blog

How to write to a file in Kotlin

Python Tkinter example