Advertisement
Guest User

Blender step making script

a guest
Dec 20th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. # tested on Blender 2.78
  2. import bpy
  3.  
  4. numSteps = 20
  5. stpWid   = 1
  6. stpLen   = 4
  7. stp1Hgt  = 1
  8. stpIncr  = 0.1
  9.  
  10. # clean the slate (delete all objects in scene)
  11. bpy.ops.object.select_all(action='SELECT') # select everything
  12. bpy.ops.object.delete(use_global=False) # delete selected
  13.  
  14. def makeCuboid(dim,loc):
  15.     bpy.ops.mesh.primitive_cube_add(radius=0.5, location=loc )
  16.     bpy.ops.transform.resize(value=dim, constraint_axis=(True, True, True))
  17.    
  18. xLoc,yLoc,zLoc = stpWid/2,stpLen/2,stp1Hgt/2
  19. CurrStpHgt = stp1Hgt
  20.  
  21. for i in range(numSteps):
  22.     makeCuboid([stpWid,stpLen,CurrStpHgt],[ xLoc,yLoc,zLoc ] )
  23.     CurrStpHgt = CurrStpHgt + stpIncr
  24.     xLoc,yLoc,zLoc = xLoc+stpWid,yLoc,zLoc+CurrStpHgt-stpIncr/2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement