Blender python & sverchok

Scripts et projects blender vu au cours: Code, Arts & Crafts : Blender advanced

Lien vers l'API python

Code python pour générer une grille de 27 cubes:

import bpy
import math
import random
i = 0
for z in range( -1, 2 ):
    for y in range( -1, 2 ):
        for x in range( -1, 2 ):
            bpy.ops.mesh.primitive_cube_add()
            cube = bpy.context.active_object
            cube.name = "Yo"
            cube.location.x = x * 4
            cube.location.y = y * 4
            cube.location.z = z * 4
            if i % 2 == 0:
                cube.rotation_euler.z = math.pi / 4
            else:
                cube.rotation_euler.x = random.random() * math.pi
            #print( i, cube )
            i += 1

Gallery

Info

Difficulty: ●●●○○

Contributors:

Last updated: 19 weeks ago

Admin