Added numOfCubes variables for each axis.
This commit is contained in:
15
Trial.py
15
Trial.py
@@ -2,23 +2,28 @@
|
|||||||
import bpy;
|
import bpy;
|
||||||
|
|
||||||
size = 1;
|
size = 1;
|
||||||
numOfCubes = 15;
|
xNumOfCubes = 3;
|
||||||
|
yNumOfCubes = 2;
|
||||||
|
zNumOfCubes = 0;
|
||||||
|
|
||||||
x = y = z = size / 2;
|
x = y = z = size / 2;
|
||||||
|
|
||||||
#Add starting cube.
|
#Creating the inital cube.
|
||||||
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
||||||
|
|
||||||
|
#I need to create an algorithm that will create the cubes in the shape of a block.
|
||||||
|
|
||||||
#Creating cubes in the X-Position.
|
#Creating cubes in the X-Position.
|
||||||
for i in range(numOfCubes):
|
for i in range(xNumOfCubes):
|
||||||
x += size;
|
x += size;
|
||||||
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
||||||
|
|
||||||
#Creating cubes in the Y-Position.
|
#Creating cubes in the Y-Position.
|
||||||
for i in range(numOfCubes):
|
for i in range(yNumOfCubes):
|
||||||
y += size;
|
y += size;
|
||||||
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
||||||
|
|
||||||
#Creating cubes in the Z-Position.
|
#Creating cubes in the Z-Position.
|
||||||
for i in range(numOfCubes):
|
for i in range(zNumOfCubes):
|
||||||
z += size;
|
z += size;
|
||||||
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
bpy.ops.mesh.primitive_cube_add(size = size, location = (x, y, z));
|
Reference in New Issue
Block a user