create pyramid using a loop and then adding button


import maya.cmds

def Pyramid():

    

    pyramid_height = 5

    

    for x in range(1,pyramid_height):   

        cmds.polyCube(w=1, h= 1, d= 1)

        cmds.move(x ,moveY = True)

        cmds.scale(pyramid_height,pyramid_height, scaleXZ = True)

        pyramid_height = pyramid_height - 1

        

#########ADDING A BUTTON###########################################################

    

window = cmds.window( title="Create a pyramid", iconName='Pyramid', widthHeight=(200, 55) )

cmds.columnLayout( adjustableColumn=True )

cmds.button( label='Create Pyramid',command = "Pyramid()"  )

cmds.showWindow( window )

    

                

#######################################################

Leave a comment

Log in with itch.io to leave a comment.