Advertisement
jeffwincek

Proportionizer 0.1.1

Oct 5th, 2011
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. # select one object
  2. # This object will sub-divide the object in the X and Z directions so that
  3. # there are divisions approximately as often as the object is tall.
  4. # requires import maya.cmds as plg
  5.  
  6. whichOne= plg.ls(selection =  True)[0]
  7. active = plg.polyEvaluate(whichOne, boundingBox = True)
  8. sizeX = active[0][1] - active[0][0]
  9. sizeY = active[1][1] - active[1][0]
  10. sizeZ = active[2][1] - active[2][0]
  11. hardPart = ''
  12. largerFactor = howMuch - 1
  13. if sizeX > sizeY:
  14.     largerFactor = float(sizeX/sizeY)
  15.     hardPart += ', sx = ' + str(largerFactor)
  16. if sizeZ > sizeY:
  17.     largerFactor = float(sizeZ/sizeY)
  18.     hardPart += ', sz = ' + str(largerFactor)
  19.    
  20. if largerFactor > howMuch:
  21.     print 'true'
  22.     thingsToCall = "plg.polyCube(\'" + whichOne + "\', e=True " + hardPart + ")"
  23.     print thingsToCall
  24.     eval(thingsToCall)
  25. else:
  26.     print 'false'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement