why don`t you try some "for in loop " inside some functions maybe could help ya producing a smaller code
xPos = 0 ; objs=['sphere1','sphere2','sphere3'] for obj in objs: cmds.sphere(n=obj) cmds.move(xPos,0,0) xPos+=3 same for joints and objExists its just a sugestion , great work keep going! 2010/1/7 Vitor Lôbo Ramos <[email protected]> > Ready. > Now is correct without errors. > > Exemple: > > import maya.cmds as cmds > import maya.cmds as mc > > mc.window() > mc.columnLayout() > mc.button ('make spheres', command="geo()") > mc.button ('move geo', command="movegeo()") > > mc.showWindow() > > def geo(): > # Create threes spheres > > cmds.sphere(n='sphere1') > cmds.move(0,0,0) > cmds.makeIdentity( apply=True ) > > cmds.sphere(n='sphere2') > cmds.move(3,0,0) > cmds.makeIdentity( apply=True ) > > cmds.sphere(n='sphere3') > cmds.move(7,0,0) > cmds.makeIdentity( apply=True ) > > ########################################################################### > > def makejts(): > > cmds.joint (n='joint1') > > cmds.joint (n='joint2') > > cmds.joint (n='joint3') > > def movegeo(): > > if cmds.objExists('sphere1'): > cmds.select('sphere1') > cmds.move(3,0,0) > else: > print ">>> sphere1 not exist" > > if cmds.objExists('sphere2'): > cmds.select('sphere2') > cmds.move(4,0,0) > else: > print ">>> sphere2 not exist" > > if cmds.objExists('sphere3'): > cmds.select('sphere3') > cmds.move(5,0,0) > else: > print ">>> sphere3 not exist" > > > #END > > > If I delete any of the spheres, the script will perform. So, without > causing any error. > > Problem resolved. > > -- > http://groups.google.com/group/python_inside_maya >
-- http://groups.google.com/group/python_inside_maya
