Hello,
I'm trying to dive in the maya python API, and for that I'm
translating one of the C++ example of a david gould.
In fact it's the second one called post1, the first one was the
command 'hello world' which I can proudly say it's working!
In the function doIt I have an error at the execution :
# NameError: global name 'tStart' is not defined //
I tried to declare tStart and tEnd but it's not working...
the code:
def doIt(self,argList):
nPosts=5
radius=.5
height=5.0
selList = om.MSelectionList()
om.MGlobal.getActiveSelectionList(selList)
dagPath=om.MDagPath()
curveFn=om.MFnNurbsCurve()
heightRatio = height/radius
iter=om.MItSelectionList(selList, om.MFn.kNurbsCurve)
while (not iter.isDone()):
iter.getDagPath(dagPath)
curveFn.setObject(dagPath)
curveFn.getKnotDomain(tStart, tEnd)
pt=om.MPoint
tIncr = (tEnd-tStart)/(nPosts-1)
for i in range(tStart, nPost+1, tIncr):
curveFn.getPointAtParam(i, pt, om.MSpace.kWorld )
py.y+=0.5*height
om.MGlobal.executeCommand('cylinder -pivot %f %f %f -
radius 0.5 -axis 0 1 0, -heightRatio %f' %(pt.x, py.y, pt.z,
heightRatio))
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---