TB1 Week 9


the week we continued with our pyramid script  I added comments to the script  so that I know what the code was later on  I also added a new button the GUI that can delete any Selected object 

import maya.cmds as cmds 

def Make_pyramid(height, size):

    if size == 'OK':

        textl = cmds.promptDialog(query=True, text=True)#makes the text box appear to set a variable with set how many times the loop will run 

    print(textl)

    i = int(textl)# converts user number into an integer

    for x in range(i):

        cmds.polyCube(width =i, depth =i)#cube command creates a new polygonal cube.

        cmds.move(0, height,0)#move command is used to change the positions of geometric objects.

        height = height+1

        i = i-1    

          

def showUI(): #used to make an UI 

    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='Delete Selected', c = 'cmds.delete( )')#deletes selected objects 

    cmds.button( label='Close', command=('cmds.deleteUI(\"' + myWin + '\", window=True)') )#closes the UI interface 

    cmds.showWindow(myWin) #make the UI show Up