|03 March 2013||#1|
Join Date: Feb 2013
Help with a little python script
Hey guys im trying to create a script in python. It should create a staircase of equally sized cubes between two selected locators. In the window you have to input the amount of stairs and the width of the staircase and maya calculates the size of the cubes.
I figured how to create the perfect sized cube, but once i added the loop the whole thing broke, giving me syntax error, where there shouldn't be any. Also when i removed the loop it gave additional errors in thing that worked before adding the loop itself. Im kind of stuck on it, so any help or suggestions will be greatly appreciated.
Thanks in advance!
This is how the script looks like right now:
import maya.cmds as cmds
selected = cmds.ls(sl=True)
posOne = cmds.xform(selected,ws=True,q=True,t=True)
posTwo = cmds.xform(selected,ws=True,q=True,t=True)
import math as math
disOne = math.fabs(posTwo -posOne)
disTwo = math.fabs(posTwo -posOne)
step = cmds.polyCube(n='stair',w=disOne/amount,h=disTwo/amount,d=width)
cmds.xform(ws=True,q=True,t=True, t=((posOne-(disOne/amount)), (posOne-(disTwo-(disOne/amount))))
cmds.move((disOne-(disOne/amount), (disTwo-(disOne/amount), 0, [stair])
stairAmount=cmds.textFieldGrp(label='Number of steps',)
stairWidth=cmds.textFieldGrp(label='Width of the staircase')
cmds.button(l='hit me',w=100,h=50,command="demStairs(float(cmds.textFieldGrp(stairWidth,q=Tru e,tx=True)), float(cmds.textFieldGrp(stairAmount,q=True,tx=True )))")
|03 March 2013||#2|
Join Date: Oct 2002
See line 15:
It has 7 open parenthesis but only 6 closing ones.
(That is not an exhaustive audit, just the syntax error that was reported over here. Next time, please include the syntax error that was reported, and enclose your code in [.code] tags to make it easier to read.)
|03 March 2013||#3|
Join Date: Sep 2003
Thread automatically closed
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|