Paste Code
Paste Blends
Paste Images
# First import bpy to get access to well... everything in blender
from bpy import *
import bpy
import math, mathutils, random

span = 10
scale = 0.5
stepA = -1.0
thrAngleA = 60
thrAngleB = 120

class GMP_Panel(bpy.types.Panel):
bl_label = "Generative Modeling"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"

def draw(self, context):
layout = self.layout

scn = bpy.context.scene

row = layout.row()
row.operator( "bpt.generate_op" )
row = layout.row()
row.operator( "bpt.reset_op" )

class GMP_Operator(bpy.types.Operator):
bl_idname = "bpt.generate_op"
bl_label = "Generate Variation"

def execute(self, context):
# Do 8 operations
clearAndSetNewObj()

return {'FINISHED'}

class GMP_Reset(bpy.types.Operator):
bl_idname = "bpt.reset_op"
bl_label = "Reset"

def execute(self, context):
# Reset
resetNewObj()

return {'FINISHED'}

def register():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Reset )
bpy.utils.register_class( GMP_Panel )

def unregister():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Reset )
bpy.utils.register_class( GMP_Panel )

# Reset Object
def resetNewObj():
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
addFirstCube()

# Add first cube
def addFirstCube():
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))

# Add first vGroup
ob = bpy.context.active_object
newGroup = ob.vertex_groups.new('vGroup')

# clearAndSetNewObj
def clearAndSetNewObj():
bpy.ops.object.select_inverse()
bpy.ops.object.delete()
bpy.ops.object.select_all(action='SELECT')

# Move Selected Object to Center(0, 0, 0) ------------------
# So we make a list of all objects we're currently working with
obList = []

# First get the active object
ob = bpy.context.active_object

# Add this object to the list
obList.append(ob)

# Set it's location to 0
ob.location = (0.0,0.0,0.0)

# Now we make copies and move them
for i in range(24):
bpy.ops.object.select_all(action='DESELECT')
ob = obList[0].name
bpy.ops.object.select_name(name=ob, extend=False)
# Duplicate the currently active object and make the new one active
bpy.ops.object.duplicate(linked=False)

# Get the new duplicated object
ob = bpy.context.active_object

# Add this object to the list
obList.append(ob)

# Set the new object's location... well this is a hacky one...
#ob.location = (i,0.0,0.0)

if i == 0:
ob.location = (-span,span,span)
operation1a()
elif i == 1:
ob.location = (-span,span,0.0)
operation1b()
elif i == 2:
ob.location = (-span,span,-span)
operation1c()
elif i == 3:
ob.location = (0.0,span,span)
operation2a()
elif i == 4:
ob.location = (0.0,span,0.0)
operation2b()
elif i == 5:
ob.location = (0.0,span,-span)
operation2c()
elif i == 6:
ob.location = (span,span,span)
operation3a()
elif i == 7:
ob.location = (span,span,0.0)
operation3b()
elif i == 8:
ob.location = (span,span,-span)
operation3c()
elif i == 9:
ob.location = (-span,0.0,span)
operation4a()
elif i == 10:
ob.location = (-span,0.0,0.0)
operation4b()
elif i == 11:
ob.location = (-span,0.0,-span)
operation4c()
elif i == 12:
ob.location = (span,0.0,span)
operation5a()
elif i == 13:
ob.location = (span,0.0,0.0)
operation5b()
elif i == 14:
ob.location = (span,0.0,-span)
operation5c()
elif i == 15:
ob.location = (-span,-span,span)
operation6a()
elif i == 16:
ob.location = (-span,-span,0.0)
operation6b()
elif i == 17:
ob.location = (-span,-span,-span)
operation6c()
elif i == 18:
ob.location = (0.0,-span,span)
operation7a()
elif i == 19:
ob.location = (0.0,-span,0.0)
operation7b()
elif i == 20:
ob.location = (0.0,-span,-span)
operation7c()
elif i == 21:
ob.location = (span,-span,span)
operation8a()
elif i == 22:
ob.location = (span,-span,0.0)
operation8b()
elif i == 23:
ob.location = (span,-span,-span)
operation8c()

bpy.ops.object.select_all(action='DESELECT')

# Print out the list of objects
print('obList is now', obList)

#Now you want to grow/ generate something so you can loop through the list
for i, ob in enumerate(obList):

print(i, ob.name)

# Set pivot to individuals
def setPivotIndi():
bpy.context.space_data.pivot_point = 'INDIVIDUAL_ORIGINS'

# Set pivot to boundingbox
def setPivotBBox():
bpy.context.space_data.pivot_point = 'BOUNDING_BOX_CENTER'

# op.1a
def operation1a():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Make a vector (direction) pointing up
up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# Math with angles is usually all in radians
if f.normal.angle(up) > math.radians(thrAngleB):
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.1b
def operation1b():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Make a vector (direction) pointing up
up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# Math with angles is usually all in radians
if f.normal.angle(up) > math.radians(thrAngleB):
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.0,1.0,1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.1c
def operation1c():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Make a vector (direction) pointing up
up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# Math with angles is usually all in radians
if f.normal.angle(up) > math.radians(thrAngleB):
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.2a
def operation2a():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Make a vector (direction) pointing up
up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# Math with angles is usually all in radians
if (f.normal.angle(up) > math.radians(thrAngleA) and f.normal.angle(up) < math.radians(thrAngleB)) and (f.center[0] > 0.5 or f.center[0] < -0.5):
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.2b
def operation2b():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Make a vector (direction) pointing up
up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# Math with angles is usually all in radians
if (f.normal.angle(up) > math.radians(thrAngleA) and f.normal.angle(up) < math.radians(thrAngleB)) and (f.center[0] > 0.5 or f.center[0] < -0.5):
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.2c
def operation2c():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Make a vector (direction) pointing up
up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# Math with angles is usually all in radians
if (f.normal.angle(up) > math.radians(thrAngleA) and f.normal.angle(up) < math.radians(thrAngleB)) and (f.center[0] > 0.5 or f.center[0] < -0.5):
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.3a
def operation3a():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for i, f in enumerate(ob.data.faces):

# See if the current face's centre is above 0.0 on the Z axis
if i % 3 == 0:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.3b
def operation3b():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for i, f in enumerate(ob.data.faces):

# See if the current face's centre is above 0.0 on the Z axis
if i % 3 == 0:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.3c
def operation3c():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for i, f in enumerate(ob.data.faces):

# See if the current face's centre is above 0.0 on the Z axis
if i % 3 == 0:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.4a
def operation4a():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# See if the current face's centre is above 0.0 on the Z axis
if f.center[2] < -0.5:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(stepA, stepA, stepA), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})

bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.4b
def operation4b():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# See if the current face's centre is above 0.0 on the Z axis
if f.center[2] < -0.5:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(stepA, stepA, stepA), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})

bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.4c
def operation4c():
setPivotIndi()
ob = bpy.context.active_object
bpy.ops.object.vertex_group_remove(all=False)
newGroup = ob.vertex_groups.new('vGroup')
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# See if the current face's centre is above 0.0 on the Z axis
if f.center[2] < -0.5:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(stepA, stepA, stepA), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})

bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# op.5a
def operation5a():
setPivotIndi()
ob = bpy.context.active_object

# Extrude selected faces already

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":-0.5, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.5b
def operation5b():
setPivotIndi()
ob = bpy.context.active_object

# Extrude selected faces already

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":-0.5, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.5c
def operation5c():
setPivotIndi()
ob = bpy.context.active_object

# Extrude selected faces already

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group='vGroup')
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":-0.5, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})

bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.6a
def operation6a():
setPivotBBox()

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -0, -1), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.6b
def operation6b():
setPivotBBox()

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, -0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.6a
def operation6c():
setPivotBBox()

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.transform.rotate(value=(1.5708,), axis=(-1, -0, -0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.7a
def operation7a():
setPivotBBox()

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.7b
def operation7b():
setPivotBBox()

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.7c
def operation7c():
setPivotBBox()

ob = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.mesh.select_all(action='TOGGLE')
bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

bpy.ops.object.mode_set(mode='OBJECT')

# op.8a
def operation8a():
bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")

# op.8b
def operation8b():
bpy.ops.object.modifier_add(type='BEVEL')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="BEVEL")

# op.8c
def operation8c():
bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")

addFirstCube()

if __name__ == '__main__':

register()
  1. # First import bpy to get access to well... everything in blender
  2. from bpy import *
  3. import bpy
  4. import math, mathutils, random
  5.  
  6. span = 10
  7. scale = 0.5
  8. stepA = -1.0
  9. thrAngleA = 60
  10. thrAngleB = 120
  11.  
  12. class GMP_Panel(bpy.types.Panel):
  13.         bl_label = "Generative Modeling"
  14.         bl_space_type = "VIEW_3D"
  15.         bl_region_type = "TOOLS"
  16.        
  17.         def draw(self, context):
  18.                 layout = self.layout
  19.                
  20.                 scn = bpy.context.scene
  21.                
  22.                 row = layout.row()
  23.                 row.operator( "bpt.generate_op" )
  24.                 row = layout.row()
  25.                 row.operator( "bpt.reset_op" )
  26.                
  27. class GMP_Operator(bpy.types.Operator):
  28.         bl_idname = "bpt.generate_op"
  29.         bl_label = "Generate Variation"
  30.  
  31.         def execute(self, context):
  32.                 # Do 8 operations
  33.                 clearAndSetNewObj()
  34.                
  35.                 return {'FINISHED'}
  36.                
  37. class GMP_Reset(bpy.types.Operator):
  38.         bl_idname = "bpt.reset_op"
  39.         bl_label = "Reset"
  40.  
  41.         def execute(self, context):
  42.                 # Reset
  43.                 resetNewObj()
  44.                
  45.                 return {'FINISHED'}
  46.  
  47. def register():
  48.         bpy.utils.register_class( GMP_Operator )
  49.         bpy.utils.register_class( GMP_Reset )
  50.         bpy.utils.register_class( GMP_Panel )
  51.  
  52. def unregister():
  53.         bpy.utils.register_class( GMP_Operator )
  54.         bpy.utils.register_class( GMP_Reset )
  55.         bpy.utils.register_class( GMP_Panel )
  56.  
  57. # Reset Object
  58. def resetNewObj():
  59.         bpy.ops.object.select_all(action='SELECT')
  60.         bpy.ops.object.delete()
  61.         addFirstCube()
  62.  
  63. # Add first cube
  64. def addFirstCube():
  65.         bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
  66.  
  67.         # Add first vGroup
  68.         ob = bpy.context.active_object
  69.         newGroup = ob.vertex_groups.new('vGroup')
  70.  
  71. # clearAndSetNewObj
  72. def clearAndSetNewObj():
  73.         bpy.ops.object.select_inverse()
  74.         bpy.ops.object.delete()
  75.         bpy.ops.object.select_all(action='SELECT')
  76.        
  77.         # Move Selected Object to Center(0, 0, 0) ------------------
  78.         # So we make a list of all objects we're currently working with
  79.         obList = []
  80.  
  81.         # First get the active object
  82.         ob = bpy.context.active_object
  83.  
  84.         # Add this object to the list
  85.         obList.append(ob)
  86.  
  87.         # Set it's location to 0
  88.         ob.location = (0.0,0.0,0.0)
  89.  
  90.         # Now we make copies and move them
  91.         for i in range(24):
  92.                 bpy.ops.object.select_all(action='DESELECT')
  93.                 ob = obList[0].name
  94.                 bpy.ops.object.select_name(name=ob, extend=False)
  95.                 # Duplicate the currently active object and make the new one active
  96.                 bpy.ops.object.duplicate(linked=False)
  97.        
  98.                 # Get the new duplicated object
  99.                 ob = bpy.context.active_object
  100.  
  101.                 # Add this object to the list
  102.                 obList.append(ob)
  103.  
  104.                 # Set the new object's location... well this is a hacky one...
  105.                 #ob.location = (i,0.0,0.0)
  106.                
  107.                 if i == 0:
  108.                         ob.location = (-span,span,span)
  109.                         operation1a()
  110.                 elif i == 1:
  111.                         ob.location = (-span,span,0.0)
  112.                         operation1b()
  113.                 elif i == 2:
  114.                         ob.location = (-span,span,-span)
  115.                         operation1c()
  116.                 elif i == 3:
  117.                         ob.location = (0.0,span,span)
  118.                         operation2a()
  119.                 elif i == 4:
  120.                         ob.location = (0.0,span,0.0)
  121.                         operation2b()
  122.                 elif i == 5:
  123.                         ob.location = (0.0,span,-span)
  124.                         operation2c()
  125.                 elif i == 6:
  126.                         ob.location = (span,span,span)
  127.                         operation3a()
  128.                 elif i == 7:
  129.                         ob.location = (span,span,0.0)
  130.                         operation3b()
  131.                 elif i == 8:
  132.                         ob.location = (span,span,-span)
  133.                         operation3c()
  134.                 elif i == 9:
  135.                         ob.location = (-span,0.0,span)
  136.                         operation4a()
  137.                 elif i == 10:
  138.                         ob.location = (-span,0.0,0.0)
  139.                         operation4b()
  140.                 elif i == 11:
  141.                         ob.location = (-span,0.0,-span)
  142.                         operation4c()
  143.                 elif i == 12:
  144.                         ob.location = (span,0.0,span)
  145.                         operation5a()
  146.                 elif i == 13:
  147.                         ob.location = (span,0.0,0.0)
  148.                         operation5b()
  149.                 elif i == 14:
  150.                         ob.location = (span,0.0,-span)
  151.                         operation5c()
  152.                 elif i == 15:
  153.                         ob.location = (-span,-span,span)
  154.                         operation6a()
  155.                 elif i == 16:
  156.                         ob.location = (-span,-span,0.0)
  157.                         operation6b()
  158.                 elif i == 17:
  159.                         ob.location = (-span,-span,-span)
  160.                         operation6c()
  161.                 elif i == 18:
  162.                         ob.location = (0.0,-span,span)
  163.                         operation7a()
  164.                 elif i == 19:
  165.                         ob.location = (0.0,-span,0.0)
  166.                         operation7b()
  167.                 elif i == 20:
  168.                         ob.location = (0.0,-span,-span)
  169.                         operation7c()
  170.                 elif i == 21:
  171.                         ob.location = (span,-span,span)
  172.                         operation8a()
  173.                 elif i == 22:
  174.                         ob.location = (span,-span,0.0)
  175.                         operation8b()
  176.                 elif i == 23:
  177.                         ob.location = (span,-span,-span)
  178.                         operation8c()
  179.        
  180.         bpy.ops.object.select_all(action='DESELECT')
  181.        
  182.         # Print out the list of objects
  183.         print('obList is now', obList)
  184.  
  185.         #Now you want to grow/ generate something so you can loop through the list
  186.         for i, ob in enumerate(obList):
  187.  
  188.                 print(i, ob.name)
  189.        
  190. # Set pivot to individuals
  191. def setPivotIndi():
  192.         bpy.context.space_data.pivot_point = 'INDIVIDUAL_ORIGINS'
  193.        
  194. # Set pivot to boundingbox
  195. def setPivotBBox():
  196.         bpy.context.space_data.pivot_point = 'BOUNDING_BOX_CENTER'
  197.        
  198. # op.1a
  199. def operation1a():
  200.         setPivotIndi()
  201.         ob = bpy.context.active_object
  202.         bpy.ops.object.vertex_group_remove(all=False)
  203.         newGroup = ob.vertex_groups.new('vGroup')
  204.         bpy.ops.object.mode_set(mode='OBJECT')
  205.        
  206.         # Make a vector (direction) pointing up
  207.         up = mathutils.Vector((0.0,0.0,1.0))
  208.  
  209.         # Lets loop through all the faces in the mesh
  210.         for f in ob.data.faces:
  211.        
  212.                 # Math with angles is usually all in radians
  213.                 if f.normal.angle(up) > math.radians(thrAngleB):
  214.                         # Set select to true
  215.                         f.select = True
  216.                 else:
  217.                         f.select = False
  218.                
  219.         bpy.ops.object.mode_set(mode='EDIT')                   
  220.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  221.         bpy.ops.object.vertex_group_assign(new=False)
  222.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  223.        
  224.         bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  225.  
  226.         bpy.ops.object.mode_set(mode='OBJECT')
  227.        
  228.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  229.                
  230.                 # op.1b
  231. def operation1b():
  232.         setPivotIndi()
  233.         ob = bpy.context.active_object
  234.         bpy.ops.object.vertex_group_remove(all=False)
  235.         newGroup = ob.vertex_groups.new('vGroup')
  236.         bpy.ops.object.mode_set(mode='OBJECT')
  237.        
  238.         # Make a vector (direction) pointing up
  239.         up = mathutils.Vector((0.0,0.0,1.0))
  240.  
  241.         # Lets loop through all the faces in the mesh
  242.         for f in ob.data.faces:
  243.        
  244.                 # Math with angles is usually all in radians
  245.                 if f.normal.angle(up) > math.radians(thrAngleB):
  246.                         # Set select to true
  247.                         f.select = True
  248.                 else:
  249.                         f.select = False
  250.                
  251.         bpy.ops.object.mode_set(mode='EDIT')                   
  252.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  253.         bpy.ops.object.vertex_group_assign(new=False)
  254.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  255.        
  256.         bpy.ops.transform.resize(value=(1.0,1.0,1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  257.  
  258.         bpy.ops.object.mode_set(mode='OBJECT')
  259.        
  260.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  261.                
  262.                 # op.1c
  263. def operation1c():
  264.         setPivotIndi()
  265.         ob = bpy.context.active_object
  266.         bpy.ops.object.vertex_group_remove(all=False)
  267.         newGroup = ob.vertex_groups.new('vGroup')
  268.         bpy.ops.object.mode_set(mode='OBJECT')
  269.        
  270.         # Make a vector (direction) pointing up
  271.         up = mathutils.Vector((0.0,0.0,1.0))
  272.  
  273.         # Lets loop through all the faces in the mesh
  274.         for f in ob.data.faces:
  275.        
  276.                 # Math with angles is usually all in radians
  277.                 if f.normal.angle(up) > math.radians(thrAngleB):
  278.                         # Set select to true
  279.                         f.select = True
  280.                 else:
  281.                         f.select = False
  282.                
  283.         bpy.ops.object.mode_set(mode='EDIT')                   
  284.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  285.         bpy.ops.object.vertex_group_assign(new=False)
  286.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  287.        
  288.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  289.  
  290.         bpy.ops.object.mode_set(mode='OBJECT')
  291.        
  292.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  293.                
  294. # op.2a
  295. def operation2a():
  296.         setPivotIndi()
  297.         ob = bpy.context.active_object
  298.         bpy.ops.object.vertex_group_remove(all=False)
  299.         newGroup = ob.vertex_groups.new('vGroup')
  300.         bpy.ops.object.mode_set(mode='OBJECT')
  301.        
  302.         # Make a vector (direction) pointing up
  303.         up = mathutils.Vector((0.0,0.0,1.0))
  304.  
  305.         # Lets loop through all the faces in the mesh
  306.         for f in ob.data.faces:
  307.        
  308.                 # Math with angles is usually all in radians
  309.                 if (f.normal.angle(up) > math.radians(thrAngleA) and f.normal.angle(up) < math.radians(thrAngleB)) and  (f.center[0] > 0.5 or f.center[0] < -0.5):
  310.                         # Set select to true
  311.                         f.select = True
  312.                 else:
  313.                         f.select = False
  314.                
  315.         bpy.ops.object.mode_set(mode='EDIT')                   
  316.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  317.         bpy.ops.object.vertex_group_assign(new=False)
  318.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  319.        
  320.         bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  321.  
  322.         bpy.ops.object.mode_set(mode='OBJECT')
  323.        
  324.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  325.        
  326. # op.2b
  327. def operation2b():
  328.         setPivotIndi()
  329.         ob = bpy.context.active_object
  330.         bpy.ops.object.vertex_group_remove(all=False)
  331.         newGroup = ob.vertex_groups.new('vGroup')
  332.         bpy.ops.object.mode_set(mode='OBJECT')
  333.        
  334.         # Make a vector (direction) pointing up
  335.         up = mathutils.Vector((0.0,0.0,1.0))
  336.  
  337.         # Lets loop through all the faces in the mesh
  338.         for f in ob.data.faces:
  339.        
  340.                 # Math with angles is usually all in radians
  341.                 if (f.normal.angle(up) > math.radians(thrAngleA) and f.normal.angle(up) < math.radians(thrAngleB)) and  (f.center[0] > 0.5 or f.center[0] < -0.5):
  342.                         # Set select to true
  343.                         f.select = True
  344.                 else:
  345.                         f.select = False
  346.                
  347.         bpy.ops.object.mode_set(mode='EDIT')                   
  348.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  349.         bpy.ops.object.vertex_group_assign(new=False)
  350.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  351.        
  352.         bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  353.  
  354.         bpy.ops.object.mode_set(mode='OBJECT')
  355.        
  356.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  357.  
  358. # op.2c
  359. def operation2c():
  360.         setPivotIndi()
  361.         ob = bpy.context.active_object
  362.         bpy.ops.object.vertex_group_remove(all=False)
  363.         newGroup = ob.vertex_groups.new('vGroup')
  364.         bpy.ops.object.mode_set(mode='OBJECT')
  365.        
  366.         # Make a vector (direction) pointing up
  367.         up = mathutils.Vector((0.0,0.0,1.0))
  368.  
  369.         # Lets loop through all the faces in the mesh
  370.         for f in ob.data.faces:
  371.        
  372.                 # Math with angles is usually all in radians
  373.                 if (f.normal.angle(up) > math.radians(thrAngleA) and f.normal.angle(up) < math.radians(thrAngleB)) and  (f.center[0] > 0.5 or f.center[0] < -0.5):
  374.                         # Set select to true
  375.                         f.select = True
  376.                 else:
  377.                         f.select = False
  378.                
  379.         bpy.ops.object.mode_set(mode='EDIT')                   
  380.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  381.         bpy.ops.object.vertex_group_assign(new=False)
  382.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  383.        
  384.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  385.  
  386.         bpy.ops.object.mode_set(mode='OBJECT')
  387.        
  388.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  389.        
  390. # op.3a
  391. def operation3a():
  392.         setPivotIndi()
  393.         ob = bpy.context.active_object
  394.         bpy.ops.object.vertex_group_remove(all=False)
  395.         newGroup = ob.vertex_groups.new('vGroup')
  396.         bpy.ops.object.mode_set(mode='OBJECT')
  397.        
  398.         # Lets loop through all the faces in the mesh
  399.         for i, f in enumerate(ob.data.faces):
  400.        
  401.                 # See if the current face's centre is above 0.0 on the Z axis
  402.                 if i % 3 == 0:
  403.                         # Set select to true
  404.                         f.select = True
  405.                 else:
  406.                         f.select = False
  407.                
  408.         bpy.ops.object.mode_set(mode='EDIT')                   
  409.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  410.         bpy.ops.object.vertex_group_assign(new=False)
  411.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  412.        
  413.         bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  414.  
  415.         bpy.ops.object.mode_set(mode='OBJECT')
  416.        
  417.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  418.        
  419. # op.3b
  420. def operation3b():
  421.         setPivotIndi()
  422.         ob = bpy.context.active_object
  423.         bpy.ops.object.vertex_group_remove(all=False)
  424.         newGroup = ob.vertex_groups.new('vGroup')
  425.         bpy.ops.object.mode_set(mode='OBJECT')
  426.        
  427.         # Lets loop through all the faces in the mesh
  428.         for i, f in enumerate(ob.data.faces):
  429.        
  430.                 # See if the current face's centre is above 0.0 on the Z axis
  431.                 if i % 3 == 0:
  432.                         # Set select to true
  433.                         f.select = True
  434.                 else:
  435.                         f.select = False
  436.                
  437.         bpy.ops.object.mode_set(mode='EDIT')                   
  438.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  439.         bpy.ops.object.vertex_group_assign(new=False)
  440.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  441.        
  442.         bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  443.  
  444.         bpy.ops.object.mode_set(mode='OBJECT')
  445.        
  446.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  447.        
  448. # op.3c
  449. def operation3c():
  450.         setPivotIndi()
  451.         ob = bpy.context.active_object
  452.         bpy.ops.object.vertex_group_remove(all=False)
  453.         newGroup = ob.vertex_groups.new('vGroup')
  454.         bpy.ops.object.mode_set(mode='OBJECT')
  455.        
  456.         # Lets loop through all the faces in the mesh
  457.         for i, f in enumerate(ob.data.faces):
  458.        
  459.                 # See if the current face's centre is above 0.0 on the Z axis
  460.                 if i % 3 == 0:
  461.                         # Set select to true
  462.                         f.select = True
  463.                 else:
  464.                         f.select = False
  465.                
  466.         bpy.ops.object.mode_set(mode='EDIT')                   
  467.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  468.         bpy.ops.object.vertex_group_assign(new=False)
  469.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":stepA, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  470.        
  471.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  472.  
  473.         bpy.ops.object.mode_set(mode='OBJECT')
  474.        
  475.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  476.        
  477. # op.4a
  478. def operation4a():
  479.         setPivotIndi()
  480.         ob = bpy.context.active_object
  481.         bpy.ops.object.vertex_group_remove(all=False)
  482.         newGroup = ob.vertex_groups.new('vGroup')
  483.         bpy.ops.object.mode_set(mode='OBJECT')
  484.        
  485.         # Lets loop through all the faces in the mesh
  486.         for f in ob.data.faces:
  487.        
  488.                 # See if the current face's centre is above 0.0 on the Z axis
  489.                 if f.center[2] < -0.5:
  490.                         # Set select to true
  491.                         f.select = True
  492.                 else:
  493.                         f.select = False
  494.                
  495.         bpy.ops.object.mode_set(mode='EDIT')                   
  496.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  497.         bpy.ops.object.vertex_group_assign(new=False)
  498.         bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(stepA, stepA, stepA), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
  499.        
  500.         bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  501.  
  502.         bpy.ops.object.mode_set(mode='OBJECT')
  503.        
  504.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  505.        
  506. # op.4b
  507. def operation4b():
  508.         setPivotIndi()
  509.         ob = bpy.context.active_object
  510.         bpy.ops.object.vertex_group_remove(all=False)
  511.         newGroup = ob.vertex_groups.new('vGroup')
  512.         bpy.ops.object.mode_set(mode='OBJECT')
  513.        
  514.         # Lets loop through all the faces in the mesh
  515.         for f in ob.data.faces:
  516.        
  517.                 # See if the current face's centre is above 0.0 on the Z axis
  518.                 if f.center[2] < -0.5:
  519.                         # Set select to true
  520.                         f.select = True
  521.                 else:
  522.                         f.select = False
  523.                
  524.         bpy.ops.object.mode_set(mode='EDIT')                   
  525.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  526.         bpy.ops.object.vertex_group_assign(new=False)
  527.         bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(stepA, stepA, stepA), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
  528.        
  529.         bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  530.  
  531.         bpy.ops.object.mode_set(mode='OBJECT')
  532.        
  533.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  534.        
  535. # op.4c
  536. def operation4c():
  537.         setPivotIndi()
  538.         ob = bpy.context.active_object
  539.         bpy.ops.object.vertex_group_remove(all=False)
  540.         newGroup = ob.vertex_groups.new('vGroup')
  541.         bpy.ops.object.mode_set(mode='OBJECT')
  542.        
  543.         # Lets loop through all the faces in the mesh
  544.         for f in ob.data.faces:
  545.        
  546.                 # See if the current face's centre is above 0.0 on the Z axis
  547.                 if f.center[2] < -0.5:
  548.                         # Set select to true
  549.                         f.select = True
  550.                 else:
  551.                         f.select = False
  552.                
  553.         bpy.ops.object.mode_set(mode='EDIT')                   
  554.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  555.         bpy.ops.object.vertex_group_assign(new=False)
  556.         bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(stepA, stepA, stepA), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "texture_space":False, "release_confirm":False})
  557.        
  558.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  559.  
  560.         bpy.ops.object.mode_set(mode='OBJECT')
  561.        
  562.         bpy.ops.transform.resize(value=(0.9, 0.9, 0.9), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  563.        
  564. # op.5a
  565. def operation5a():
  566.         setPivotIndi()
  567.         ob = bpy.context.active_object
  568.        
  569.         # Extrude selected faces already
  570.                
  571.         bpy.ops.object.mode_set(mode='EDIT')                   
  572.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  573.         bpy.ops.object.vertex_group_assign(new=False)
  574.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":-0.5, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  575.        
  576.         bpy.ops.transform.resize(value=(0.5, 0.5, 0.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  577.  
  578.         bpy.ops.object.mode_set(mode='OBJECT')
  579.        
  580. # op.5b
  581. def operation5b():
  582.         setPivotIndi()
  583.         ob = bpy.context.active_object
  584.        
  585.         # Extrude selected faces already
  586.                
  587.         bpy.ops.object.mode_set(mode='EDIT')                   
  588.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  589.         bpy.ops.object.vertex_group_assign(new=False)
  590.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":-0.5, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  591.        
  592.         bpy.ops.transform.resize(value=(1.0, 1.0, 1.0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  593.  
  594.         bpy.ops.object.mode_set(mode='OBJECT')
  595.        
  596. # op.5c
  597. def operation5c():
  598.         setPivotIndi()
  599.         ob = bpy.context.active_object
  600.        
  601.         # Extrude selected faces already
  602.                
  603.         bpy.ops.object.mode_set(mode='EDIT')                   
  604.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  605.         bpy.ops.object.vertex_group_assign(new=False)
  606.         bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_shrink_fatten={"value":-0.5, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})
  607.        
  608.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  609.  
  610.         bpy.ops.object.mode_set(mode='OBJECT')
  611.        
  612. # op.6a
  613. def operation6a():
  614.         setPivotBBox()
  615.  
  616.         ob = bpy.context.active_object
  617.         bpy.ops.object.mode_set(mode='EDIT')
  618.         bpy.ops.mesh.select_all(action='TOGGLE')
  619.         bpy.ops.mesh.select_all(action='TOGGLE')
  620.         bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -0, -1), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  621.  
  622.         bpy.ops.object.mode_set(mode='OBJECT')
  623.        
  624. # op.6b
  625. def operation6b():
  626.         setPivotBBox()
  627.  
  628.         ob = bpy.context.active_object
  629.         bpy.ops.object.mode_set(mode='EDIT')
  630.         bpy.ops.mesh.select_all(action='TOGGLE')
  631.         bpy.ops.mesh.select_all(action='TOGGLE')
  632.         bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, -0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  633.  
  634.         bpy.ops.object.mode_set(mode='OBJECT')
  635.  
  636. # op.6a
  637. def operation6c():
  638.         setPivotBBox()
  639.  
  640.         ob = bpy.context.active_object
  641.         bpy.ops.object.mode_set(mode='EDIT')
  642.         bpy.ops.mesh.select_all(action='TOGGLE')
  643.         bpy.ops.mesh.select_all(action='TOGGLE')
  644.         bpy.ops.transform.rotate(value=(1.5708,), axis=(-1, -0, -0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  645.  
  646.         bpy.ops.object.mode_set(mode='OBJECT')
  647.        
  648. # op.7a
  649. def operation7a():
  650.         setPivotBBox()
  651.  
  652.         ob = bpy.context.active_object
  653.         bpy.ops.object.mode_set(mode='EDIT')
  654.         bpy.ops.mesh.select_all(action='TOGGLE')
  655.         bpy.ops.mesh.select_all(action='TOGGLE')
  656.         bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  657.  
  658.         bpy.ops.object.mode_set(mode='OBJECT')
  659.  
  660. # op.7b
  661. def operation7b():
  662.         setPivotBBox()
  663.  
  664.         ob = bpy.context.active_object
  665.         bpy.ops.object.mode_set(mode='EDIT')
  666.         bpy.ops.mesh.select_all(action='TOGGLE')
  667.         bpy.ops.mesh.select_all(action='TOGGLE')
  668.         bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  669.  
  670.         bpy.ops.object.mode_set(mode='OBJECT')
  671.  
  672. # op.7c
  673. def operation7c():
  674.         setPivotBBox()
  675.  
  676.         ob = bpy.context.active_object
  677.         bpy.ops.object.mode_set(mode='EDIT')
  678.         bpy.ops.mesh.select_all(action='TOGGLE')
  679.         bpy.ops.mesh.select_all(action='TOGGLE')
  680.         bpy.ops.transform.rotate(value=(1.5708,), axis=(-0, -1, 0), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  681.  
  682.         bpy.ops.object.mode_set(mode='OBJECT')
  683.        
  684. # op.8a
  685. def operation8a():
  686.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  687.         bpy.ops.object.modifier_add(type='SUBSURF')
  688.         bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
  689.        
  690. # op.8b
  691. def operation8b():
  692.         bpy.ops.object.modifier_add(type='BEVEL')
  693.         bpy.ops.object.modifier_apply(apply_as='DATA', modifier="BEVEL")
  694.        
  695. # op.8c
  696. def operation8c():
  697.         bpy.ops.transform.resize(value=(1.5, 1.5, 1.5), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  698.         bpy.ops.object.modifier_add(type='SUBSURF')
  699.         bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
  700.  
  701. addFirstCube()
  702.  
  703. if __name__ == '__main__':
  704.  
  705.         register()
  706.  
go to heaven