Below is my code for a stair generator that I created using simple rotations and structured coding. The first 2 pictures are my code in Maya's python.
Below is a segment of my work that is working, the stair masters button layout is below and shows that it is working within the code.
Below is unfortunately the errors I encountered during the coding process as I could not work out what the syntax error was, I tried my best in trying to figure it out I managed to get the button code working great but not the rest of the code unfortunately.
The code that is in red does not work due to a syntax error however the code in green does work and there is evidence of this above.
import maya.cmds as cmds if cmds.window("Stairmaster",exists=True): cmds.deleteUI("Stairmaster") window=cmds.window("Stairmaster", title= "Jack's Stair Master") cmds.columnLayout() cmds.text(label='StairSize') cmds.text(label='Step Number') cmds.intField("Steps", minValue=0,maxValue=50,value=1) cmds.button(label="Spiral Mode", command="Spiral()") cmds.button(label="Boring Regular Mode", command="Normal()") cmds.button(label="Regular With Rail Mode", command="Rail()") def Spiral(): Nstep=cmds.intField("Steps", q=True, value=True) step=[] for number in range(Nstep): print number step.append(cmds.polyCube(w=5, d=2, h=5, n='Smallstep')[0]) cmds.move(3, number*1,0,r=True) cmds.xform(ws=True, rotatePivot=(0,0,0)) cmds.rotate(0,15*number,0) twiststeps=cmds.group(step, name="twiststeps1") towerpillar=cmds.polyCylinder(r=2, h=Nstep, n="pillar1") cmds.move(0,9.6,0,r=True) EntireStaircase=cmds.group('twiststeps1','pillar1' n='EntireStaircase') def Normal(): Nstep=cmds.intField("Steps",q=True,Value=True) step[] for number in range(Nstep): print number step.append(cmds.polyCube(d=2, h=1, w=8, n='Smallstep')[0]) cmds.move(0,number/1,number/-5) Staircase=cmds.group(step,name='Staircase') print step def Rail(): Nstep=cmds.intField("Steps",q=True,Value=True) step[] for number in range(Nstep): print number step.append(cmds.polyCube(d=2, h=1, w=8, n='Smallstep')[0]) cmds.move(0,number/1,number/-5) Staircase=cmds.group(step,name='Staircase') print step Leftrail=[] for number in range(Nstep): print number Leftrail.append(cmds.polyCylinder(r=.05, h=6)[0]) cmds.move(3.0, number/1.0, number/-.5) lilLrail= cmds.group(Leftrail,name = lilLrails) cmds.move( 0, 3, 0, r=True, os=True, wd=True) print Leftrail Rightrail=[] for number in range(Nstep): print number Rightrail.append(cmds.polyCylinder(r=.05, h=6)[0]) cmds.move(-3.0, number/1.0, number/-.5) lilRrail= cmds.group(Rightrail,name = lilRrails) cmds.move( 0, 3, 0, r=True, os=True, wd=True) print Rightrail banisLeft = cmds.polyCube( sx=1, sy=1, sz=1, h=.2, w=.5, d=17,n = banisLeft) cmds.rotate(27, 0, 0) cmds.move(2.96, 9.381,-6.71) banisRight = cmds.polyCube( sx=1, sy=1, sz=1, h=.2, w=.5, d=17,n = banisRight) cmds.rotate(27, 0, 0) cmds.move(-2.96, 9.381,-6.71) arms=cmds.group('banisLeft', 'banisRight', 'lilRrails', 'lilLrails', 'Staircase',n='EntireRailStaircase') cmds.showWindow()



