Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # select one object
- # This object will sub-divide the object in the X and Z directions so that
- # there are divisions approximately as often as the object is tall.
- # requires import maya.cmds as plg
- whichOne= plg.ls(selection = True)[0]
- active = plg.polyEvaluate(whichOne, boundingBox = True)
- sizeX = active[0][1] - active[0][0]
- sizeY = active[1][1] - active[1][0]
- sizeZ = active[2][1] - active[2][0]
- hardPart = ''
- largerFactor = howMuch - 1
- if sizeX > sizeY:
- largerFactor = float(sizeX/sizeY)
- hardPart += ', sx = ' + str(largerFactor)
- if sizeZ > sizeY:
- largerFactor = float(sizeZ/sizeY)
- hardPart += ', sz = ' + str(largerFactor)
- if largerFactor > howMuch:
- print 'true'
- thingsToCall = "plg.polyCube(\'" + whichOne + "\', e=True " + hardPart + ")"
- print thingsToCall
- eval(thingsToCall)
- else:
- print 'false'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement