Added numOfCubes variables for each axis.

This commit is contained in:
CJ Satnarine
2023-02-22 13:02:46 -05:00
committed by GitHub
parent e973773137
commit 1c17b1722d

View File

@@ -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));
#Creating cubes in the X-Position. #I need to create an algorithm that will create the cubes in the shape of a block.
for i in range(numOfCubes):
#Creating cubes in the X-Position.
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));