Added unique location and scale for cubes
This commit is contained in:
parent
ff25b5c33d
commit
2e52ee90db
@ -1,17 +1,27 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from random import randint
|
import random
|
||||||
count = 100
|
|
||||||
|
count = 50
|
||||||
cubes=[]
|
cubes=[]
|
||||||
|
locationList=[]
|
||||||
|
scaleList=[]
|
||||||
|
i = 1
|
||||||
|
while i < count+1:
|
||||||
|
locationList.append(i)
|
||||||
|
scaleList.append(i)
|
||||||
|
i += 1
|
||||||
|
random.shuffle(locationList)
|
||||||
|
random.shuffle(scaleList)
|
||||||
i = 0
|
i = 0
|
||||||
while i < count:
|
while i < count:
|
||||||
x = randint(1,10)
|
cube = bpy.ops.mesh.primitive_cube_add(location=(locationList[i], 0, 0), scale=(0.25, 0.25, 0.25))
|
||||||
cube = bpy.ops.mesh.primitive_cube_add(location=(x, 0, 0), scale=(0.25, 0.25, 0.25))
|
|
||||||
i+=1
|
i+=1
|
||||||
|
i = 0
|
||||||
for ob in bpy.data.objects:
|
for ob in bpy.data.objects:
|
||||||
z = randint(1,10)
|
|
||||||
if ob.type == 'MESH':
|
if ob.type == 'MESH':
|
||||||
ob.scale.z = z
|
ob.scale.z = scaleList[i]
|
||||||
cubes.append(ob)
|
cubes.append(ob)
|
||||||
|
i += 1
|
||||||
n = len(cubes)
|
n = len(cubes)
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
already_sorted = True
|
already_sorted = True
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from random import randint
|
import random
|
||||||
count = 50
|
count = 50
|
||||||
cubes=[]
|
cubes=[]
|
||||||
|
locationList=[]
|
||||||
|
scaleList=[]
|
||||||
|
i = 1
|
||||||
|
while i < count+1:
|
||||||
|
locationList.append(i)
|
||||||
|
scaleList.append(i)
|
||||||
|
i += 1
|
||||||
|
random.shuffle(locationList)
|
||||||
|
random.shuffle(scaleList)
|
||||||
i = 0
|
i = 0
|
||||||
while i < count:
|
while i < count:
|
||||||
x = randint(1,10)
|
cube = bpy.ops.mesh.primitive_cube_add(location=(locationList[i], 0, 0), scale=(0.25, 0.25, 0.25))
|
||||||
cube = bpy.ops.mesh.primitive_cube_add(location=(x, 0, 0), scale=(0.25, 0.25, 0.25))
|
|
||||||
i+=1
|
i+=1
|
||||||
|
i = 0
|
||||||
for ob in bpy.data.objects:
|
for ob in bpy.data.objects:
|
||||||
z = randint(1,10)
|
|
||||||
if ob.type == 'MESH':
|
if ob.type == 'MESH':
|
||||||
ob.scale.z = z
|
ob.scale.z = scaleList[i]
|
||||||
cubes.append(ob)
|
cubes.append(ob)
|
||||||
|
i += 1
|
||||||
n = len(cubes)
|
n = len(cubes)
|
||||||
for i in range(1, n):
|
for i in range(1, n):
|
||||||
key_item = cubes[i]
|
key_item = cubes[i]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user