Here's my code so far. Ignore some of the code that doesn't seem to 'do' anything. It's a work in progress! The problem lies in a complete piece of code/script that *should *run. I'm putting blue lines in where I think the issue might be:
*1. import maya.cmds as mc* * import pymel.core.datatypes as pym * * #clearing up the scene * * mc.select(all=True)* * mc.delete()* * #defining my User Interface window* *10.* * def createSUI():* * #checking to see if my window exists and deleting* * if mc.window('myWin', exists=True):* * mc.deleteUI('myWin')* * #creating window and setting layout* * windowID = mc.window('myWin', rtf=True, t="Can't Stop Stairing - Stair Maker 2015", backgroundColor=(0.2, 0.2, 0.2), mnb=False, mxb=False, sizeable=True)* * mc.columnLayout(w=400, h=600)* *20. * * #placing banner image* * imagePath = mc.internalVar(userPrefDir=True) +'icons/stairImage.png'* * mc.image(image=imagePath)* * mc.separator(h=5)* * #creating my physical in-window sliders* * mc.intSliderGrp('stepWidthSlider', l = 'Step Width', v=20, min=1, max=40, field=True)* * mc.separator(h=5)* *30. mc.floatSliderGrp('stepHeightSlider', l = 'Step Height', v=4.2, min=0.5, max=8.0, field=True)* * mc.separator(h=5)* * mc.floatSliderGrp('stepDepthSlider', l = 'Step Depth', v=5.2, min=0.5, max=10, field=True)* * mc.separator(h=5)* * mc.intSliderGrp('numSteps', l = 'Number of Steps', v=50, min=2, max=100, field=True)* * mc.separator(h=5)* * #creating my physical in-window button* * mc.button(l= 'Make Step', backgroundColor=(0.25, 0.25, 0.25), w=400, h=50, c = 'myStep()')* *40. mc.separator(h=5)* * mc.button(l= 'Make Spiral Stairs', backgroundColor=(0.3, 0.3, 0.3), w=400, h=50, c='makeSpiralStairs()')* * mc.separator(h=5)* * mc.button(l= 'Make Straight Stairs', backgroundColor=(0.35, 0.35, 0.35), w=400, h=50, c='makeStraightStairs()')* * mc.separator(h=5)* * mc.button(l= 'Change Stair Material', backgroundColor=(0.4, 0.4, 0.4), w=400, h=50, c='applyMaterial()')* * mc.separator(h=5)* * mc.button(l= 'Delete All', backgroundColor=(0.45, 0.45, 0.45), w=400, h=50, c='deleteStairs()')* * mc.showWindow('myWin')* *50. #fetching data from User Interface sliders* * def myStep():* * mc.polyCube(w = myStepWidth(), h = myStepHeight(), d = myStepDepth(), n = 'myStep') **~~~~~~~~~~~~* * def myStepDepth():* * return mc.floatSliderGrp('stepDepthSlider', q = True, value = True) **~~~~~~~~~~~~* * def myStepHeight():* * return mc.floatSliderGrp('stepHeightSlider', q = True, value = True) * *60. * * def myStepWidth():* * return mc.intSliderGrp('stepWidthSlider', q = True, value = True)* * def numOfMySteps():* * return mc.intSliderGrp('numSteps', q = True, value = True)* * #calculating rotate integer for Spiral Stairs from step dimension slider values * * def rotationRadian():* *70. return pym.atan((myStepDepth()-(0.15*myStepDepth()))/myStepWidth()) ~~~~~~~~~~~~* * print rotationRadian()* * def rotationFactor():* * return pym.degrees(rotationRadian())* * print rotationFactor() * * def makeSpiralStairs():* * i=0* *80. myStep()* * while i < 80:* * mc.duplicate()* * mc.move(0, myStepHeight(), 0, relative=True)* * mc.rotate(0, rotationFactor(), 0, relative=True) * *~~~~~~~~~~~~* * i+=1* * def makeStraightStairs():* * myStep()* *90. mc.duplicate (rr = True)* * mc.move (0, 0.8*myStepHeight(), -0.8*myStepDepth(), relative = True) **~~~~~~~~~~~~* * for i in range (numOfMySteps()):* * #Duplicates the step again using the previous transform* * mc.duplicate (rr = True, st = True)* * def applyMaterial():* * myShader = mc.shadingNode('mia_material_x', asShader=True)* * mc.select('myCube*')* *100. mc.hyperShade(assign = myShader) * * def deleteStairs():* * mc.select(all=True)* * mc.delete() * * createSUI()* 110. The error code is exactly: #Error: RuntimeError: file <maya console> line 56: Object 'stepDepthSlider' not found. I don't know what could be wrong? The only difference in stepDepthSlider is that it is used in my rotate function... but so is stepWidthSlider! Thanks Kate -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8314ae1e-505e-4c1b-a719-550049e8b279%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.