pyramid script firstDraft


import maya.cmds

cmds.file( f=True, new=True)

if cmds.window("new_window", exists=True):

    cmds.deleteUI("new_window", window=True)

        

def custom_pyramid(custom_layer): #input can be used later

    custom_layer = cmds.intField(custom_layer, query = True, value = True)

    pyramid(custom_layer)

def pyramid(layers):

    cmds.polyPlane(w=layers*3, h=layers*3) #floorplane

    cmds.move(0,-0.5,0) #moves down slightly

    for i in range(layers): #one loop for each layer

        dimension=((layers*2)-(i*2))

        cmds.polyCube(w=dimension, d=dimension)

        cmds.move(0,(i),0)

                

if cmds.window("new_window", exists=True):

    cmds.deleteUI("new_window", window=True)

window = cmds.window( "new_window", title="NEW Window", widthHeight=(200, 300), bgc=(1,0.8,0.7))

cmds.columnLayout( adjustableColumn=True )

cmds.button( label='10 Layers.',c='pyramid(10)', height=30, bgc=(1,0.85,0))

cmds.button( label='20 Layers?',c='pyramid(20)', height=50, bgc=(0.88,0.6,0.05)) #fixed this function

cmds.button( label='30 LAYERS!',c='pyramid(30)', height=70, bgc=(0.98,0.42,0))

cmds.button( label='CUSTOM LAYERS!!! (type below: 1 to 1000)',c='custom_pyramid(custom_layer_field)', height=90, bgc=(0.88,0.18,0.05))

custom_layer_field = cmds.intField( minValue=1, maxValue=1000, v=1, bgc=(0.88,0.18,0.05))

cmds.button( label='Close', command=('cmds.deleteUI("new_window", window=True)'), height=40, bgc=(1,0,0))

cmds.setParent( '..' )

cmds.showWindow( window )

Leave a comment

Log in with itch.io to leave a comment.