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

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" )

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

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

return {'FINISHED'}

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

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


# Add first cube
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))

# SubSurf and Apply
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")

# 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(8):
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,0.0)
operation1()
elif i == 1:
ob.location = (0.0,span,0.0)
operation2()
elif i == 2:
ob.location = (span,span,0.0)
operation3()
elif i == 3:
ob.location = (-span,0.0,0.0)
operation4()
elif i == 4:
ob.location = (span,0.0,0.0)
operation5()
elif i == 5:
ob.location = (-span,-span,0.0)
operation6()
elif i == 6:
ob.location = (0.0,-span,0.0)
operation7()
elif i == 7:
ob.location = (span,-span,0.0)
operation8()

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():
# Get the screen areas we are working in right now
areas = bpy.context.screen.areas

for area in areas:

# See if the current area is a 3D view
if area.type == 'VIEW_3D':

# Set the pivot point to individual origins
area.active_space.pivot_point = 'INDIVIDUAL_ORIGINS'

# Set pivot to boundingbox
def setPivotBBox():
# Get the screen areas we are working in right now
areas = bpy.context.screen.areas

for area in areas:

# See if the current area is a 3D view
if area.type == 'VIEW_3D':

# Set the pivot point to individual origins
area.active_space.pivot_point = 'BOUNDING_BOX_CENTER'

# op.1
def operation1():
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_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.2
def operation2():
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[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":-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.3
def operation3():
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":-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.4
def operation4():
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":(-0.5, -0.5, -0.5), "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')
# op.5
def operation5():
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.6
def operation6():
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.7
def operation7():
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.8
def operation8():
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")

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.  
  9. class GMP_Panel(bpy.types.Panel):
  10.         bl_label = "Generative Modeling"
  11.         bl_space_type = "VIEW_3D"
  12.         bl_region_type = "TOOLS"
  13.        
  14.         def draw(self, context):
  15.                 layout = self.layout
  16.                
  17.                 scn = bpy.context.scene
  18.                
  19.                 row = layout.row()
  20.                
  21.                 row.operator( "bpt.generate_op" )
  22.                
  23. class GMP_Operator(bpy.types.Operator):
  24.         bl_idname = "bpt.generate_op"
  25.         bl_label = "Generate"
  26.  
  27.         def execute(self, context):
  28.                 # Do 8 operations
  29.                 clearAndSetNewObj()
  30.                
  31.                 return {'FINISHED'}
  32.  
  33. def register():
  34.         bpy.utils.register_class( GMP_Operator )
  35.         bpy.utils.register_class( GMP_Panel )
  36.  
  37. def unregister():
  38.         bpy.utils.register_class( GMP_Operator )
  39.         bpy.utils.register_class( GMP_Panel )
  40.  
  41.  
  42. # Add first cube
  43. 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))
  44.  
  45. # SubSurf and Apply
  46. bpy.ops.object.modifier_add(type='SUBSURF')
  47. bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
  48.  
  49. # Add first vGroup
  50. ob = bpy.context.active_object
  51. newGroup = ob.vertex_groups.new('vGroup')
  52.  
  53. # clearAndSetNewObj
  54. def clearAndSetNewObj():
  55.         bpy.ops.object.select_inverse()
  56.         bpy.ops.object.delete()
  57.         bpy.ops.object.select_all(action='SELECT')
  58.        
  59.         # Move Selected Object to Center(0, 0, 0) ------------------
  60.         # So we make a list of all objects we're currently working with
  61.         obList = []
  62.  
  63.         # First get the active object
  64.         ob = bpy.context.active_object
  65.  
  66.         # Add this object to the list
  67.         obList.append(ob)
  68.  
  69.         # Set it's location to 0
  70.         ob.location = (0.0,0.0,0.0)
  71.  
  72.         # Now we make copies and move them
  73.         for i in range(8):
  74.                 bpy.ops.object.select_all(action='DESELECT')
  75.                 ob = obList[0].name
  76.                 bpy.ops.object.select_name(name=ob, extend=False)
  77.                 # Duplicate the currently active object and make the new one active
  78.                 bpy.ops.object.duplicate(linked=False)
  79.        
  80.                 # Get the new duplicated object
  81.                 ob = bpy.context.active_object
  82.  
  83.                 # Add this object to the list
  84.                 obList.append(ob)
  85.  
  86.                 # Set the new object's location... well this is a hacky one...
  87.                 #ob.location = (i,0.0,0.0)
  88.                
  89.                 if i == 0:
  90.                         ob.location = (-span,span,0.0)
  91.                         operation1()
  92.                 elif i == 1:
  93.                         ob.location = (0.0,span,0.0)
  94.                         operation2()
  95.                 elif i == 2:
  96.                         ob.location = (span,span,0.0)
  97.                         operation3()
  98.                 elif i == 3:
  99.                         ob.location = (-span,0.0,0.0)
  100.                         operation4()
  101.                 elif i == 4:
  102.                         ob.location = (span,0.0,0.0)
  103.                         operation5()
  104.                 elif i == 5:
  105.                         ob.location = (-span,-span,0.0)
  106.                         operation6()
  107.                 elif i == 6:
  108.                         ob.location = (0.0,-span,0.0)
  109.                         operation7()
  110.                 elif i == 7:
  111.                         ob.location = (span,-span,0.0)
  112.                         operation8()
  113.        
  114.         bpy.ops.object.select_all(action='DESELECT')
  115.        
  116.         # Print out the list of objects
  117.         print('obList is now', obList)
  118.  
  119.         #Now you want to grow/ generate something so you can loop through the list
  120.         for i, ob in enumerate(obList):
  121.  
  122.                 print(i, ob.name)
  123.        
  124. # Set pivot to individuals
  125. def setPivotIndi():
  126.         # Get the screen areas we are working in right now
  127.         areas = bpy.context.screen.areas
  128.        
  129.         for area in areas:
  130.  
  131.                 # See if the current area is a 3D view
  132.                 if area.type == 'VIEW_3D':
  133.  
  134.                         # Set the pivot point to individual origins
  135.                         area.active_space.pivot_point = 'INDIVIDUAL_ORIGINS'
  136.                        
  137. # Set pivot to boundingbox
  138. def setPivotBBox():
  139.         # Get the screen areas we are working in right now
  140.         areas = bpy.context.screen.areas
  141.  
  142.         for area in areas:
  143.  
  144.                 # See if the current area is a 3D view
  145.                 if area.type == 'VIEW_3D':
  146.  
  147.                         # Set the pivot point to individual origins
  148.                         area.active_space.pivot_point = 'BOUNDING_BOX_CENTER'
  149.  
  150. # op.1
  151. def operation1():
  152.         setPivotIndi()
  153.         ob = bpy.context.active_object
  154.         bpy.ops.object.vertex_group_remove(all=False)
  155.         newGroup = ob.vertex_groups.new('vGroup')
  156.         bpy.ops.object.mode_set(mode='OBJECT')
  157.        
  158.         # Lets loop through all the faces in the mesh
  159.         for f in ob.data.faces:
  160.        
  161.                 # See if the current face's centre is above 0.0 on the Z axis
  162.                 if f.center[2] < -0.5:
  163.                         # Set select to true
  164.                         f.select = True
  165.                 else:
  166.                         f.select = False
  167.                
  168.         bpy.ops.object.mode_set(mode='EDIT')                   
  169.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  170.         bpy.ops.object.vertex_group_assign(new=False)
  171.         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})
  172.        
  173.         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)
  174.  
  175.         bpy.ops.object.mode_set(mode='OBJECT')
  176.                
  177. # op.2
  178. def operation2():
  179.         setPivotIndi()
  180.         ob = bpy.context.active_object
  181.         bpy.ops.object.vertex_group_remove(all=False)
  182.         newGroup = ob.vertex_groups.new('vGroup')
  183.         bpy.ops.object.mode_set(mode='OBJECT')
  184.        
  185.         # Lets loop through all the faces in the mesh
  186.         for f in ob.data.faces:
  187.        
  188.                 # See if the current face's centre is above 0.0 on the Z axis
  189.                 if (f.center[0] > 0.5 or f.center[0] < -0.5):
  190.                         # Set select to true
  191.                         f.select = True
  192.                 else:
  193.                         f.select = False
  194.                
  195.         bpy.ops.object.mode_set(mode='EDIT')                   
  196.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  197.         bpy.ops.object.vertex_group_assign(new=False)
  198.         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})
  199.        
  200.         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)
  201.  
  202.         bpy.ops.object.mode_set(mode='OBJECT')
  203.  
  204. # op.3
  205. def operation3():
  206.         setPivotIndi()
  207.         ob = bpy.context.active_object
  208.         bpy.ops.object.vertex_group_remove(all=False)
  209.         newGroup = ob.vertex_groups.new('vGroup')
  210.         bpy.ops.object.mode_set(mode='OBJECT')
  211.        
  212.         # Lets loop through all the faces in the mesh
  213.         for i, f in enumerate(ob.data.faces):
  214.        
  215.                 # See if the current face's centre is above 0.0 on the Z axis
  216.                 if i % 3 == 0:
  217.                         # Set select to true
  218.                         f.select = True
  219.                 else:
  220.                         f.select = False
  221.                
  222.         bpy.ops.object.mode_set(mode='EDIT')                   
  223.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  224.         bpy.ops.object.vertex_group_assign(new=False)
  225.         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})
  226.        
  227.         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)
  228.  
  229.         bpy.ops.object.mode_set(mode='OBJECT')
  230.        
  231. # op.4
  232. def operation4():
  233.         setPivotIndi()
  234.         ob = bpy.context.active_object
  235.         bpy.ops.object.vertex_group_remove(all=False)
  236.         newGroup = ob.vertex_groups.new('vGroup')
  237.         bpy.ops.object.mode_set(mode='OBJECT')
  238.        
  239.         # Lets loop through all the faces in the mesh
  240.         for f in ob.data.faces:
  241.        
  242.                 # See if the current face's centre is above 0.0 on the Z axis
  243.                 if f.center[2] < -0.5:
  244.                         # Set select to true
  245.                         f.select = True
  246.                 else:
  247.                         f.select = False
  248.                
  249.         bpy.ops.object.mode_set(mode='EDIT')                   
  250.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  251.         bpy.ops.object.vertex_group_assign(new=False)
  252.         bpy.ops.mesh.extrude_region_move(MESH_OT_extrude={"type":'REGION'}, TRANSFORM_OT_translate={"value":(-0.5, -0.5, -0.5), "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})
  253.        
  254.         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)
  255.  
  256.         bpy.ops.object.mode_set(mode='OBJECT')
  257. # op.5
  258. def operation5():
  259.         setPivotIndi()
  260.         ob = bpy.context.active_object
  261.        
  262.         # Extrude selected faces already
  263.                
  264.         bpy.ops.object.mode_set(mode='EDIT')                   
  265.         bpy.ops.object.vertex_group_set_active(group='vGroup')
  266.         bpy.ops.object.vertex_group_assign(new=False)
  267.         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})
  268.        
  269.         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)
  270.  
  271.         bpy.ops.object.mode_set(mode='OBJECT')
  272.        
  273. # op.6
  274. def operation6():
  275.         setPivotBBox()
  276.  
  277.         ob = bpy.context.active_object
  278.         bpy.ops.object.mode_set(mode='EDIT')
  279.         bpy.ops.mesh.select_all(action='TOGGLE')
  280.         bpy.ops.mesh.select_all(action='TOGGLE')
  281.         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)
  282.  
  283.         bpy.ops.object.mode_set(mode='OBJECT')
  284.        
  285. # op.7
  286. def operation7():
  287.         setPivotBBox()
  288.  
  289.         ob = bpy.context.active_object
  290.         bpy.ops.object.mode_set(mode='EDIT')
  291.         bpy.ops.mesh.select_all(action='TOGGLE')
  292.         bpy.ops.mesh.select_all(action='TOGGLE')
  293.         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)
  294.  
  295.         bpy.ops.object.mode_set(mode='OBJECT')
  296. # op.8
  297. def operation8():
  298.         bpy.ops.object.modifier_add(type='SUBSURF')
  299.         bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
  300.  
  301. if __name__ == '__main__':
  302.  
  303.         register()
  304.  
go to heaven