Posted December 12, 2022 by TheWigum
This week we carried on with the pyramid script I started again with the code, and I asked people in my class for help this is the code they subjected to use
import maya.cmds as cmds
def Make_pyramid(height, size):
if size == 'OK':
textl= cmds.promptDialog(query=True, text=True)
print(text1)
i = int(text1)
for x in range(i):
cmds.polyCube(width =i, depth =i)
cmds.move(0, height,0)
height = height+1
i = i-1
def showUI():
myWin = cmds.window(title="summoing Winow", widthHeight=(300, 200))
cmds.columnLayout()
cmds.button( label='Summon Pyraimd', c = "Make_pyramid(1, cmds.promptDialog( title='input cube amount', message='Amount:',button=['OK', 'Cancel'], defaultButton='1',cancelButton='Cancel',dismissString='Cancel',))")
cmds.button( label='Close', command=('cmds.deleteUI(\"' + myWin + '\", window=True)') )
cmds.showWindow(myWinshowUI()
this code works slightly differently then my original script with this code you can set how many cubes the pyramid is with the GUI that is created when you run the script it does this by asking the user for how many cube they want the sets the with a variable "text1" this forms how long the loop will run for, by turning the user input to an integer.