View Full Version : Python script help

11 November 2012, 12:13 AM
Hi guys,

This is my first post here I hope I can get some help on this. So I am working on my group project in uni and my job is to develop a Python script that generates procedural gears. The problems is that I can't figure out how to work with gears animation

This is what I have so far :
#Gears script import maya.cmds as cmds

import math

def gears():

g = input()

list = []

for j in range(0, g):

x = cmds.polyCylinder(r = 5, h = 2, sx = 10)

y = cmds.polyCylinder(x, q = True, sx = True)


for i in range(y):

cmds.polyExtrudeFacet(list[j] +'.f[' + str(i) + ']',kft=False, ltz=2, ls=(.5, .5, 0))

bbx = cmds.xform(list[0], q = True, bb = True)

diam = bbx[3]+bbx[3]

rot = -18

for i in range(0, g):

cmds.move(diam*i, 0, 0, list[i], os = True)

for i in range(0, g):

cmds.rotate(0, rot*i, 0, list[i], os = True)

for i in range(0, (g-1)):

cmds.setDrivenKeyframe(cd = 'list['+str(i)+']', at='list['+str(i+1)+']' )


The problem with this I keep getting error with the setDrivenKeyframe command. (error message: # Error: line 1: RuntimeError: file <maya console> line 22: No match found to driver: list[0] # ). I suppose it has to do something with Python not picking up the objects in the list. If somebody could help me that would be amazing!! :)

CGTalk Moderation
11 November 2012, 12:13 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.