有一些问题基本上是插入一堆由循环生成的标志:
def drawHelix(radius, length, coils):
numPoints = int(8)
degrees = float((360 / numPoints))
centerX = float(0)
centerZ = float(0)
xLoc = float(0)
zLoc = float(0)
yLoc = float(0)
yOffset = float(((length / coils) / numPoints))
vectorIndex = int(0)
pointStr = ""
knotStr = ""
for i in range(1, (360 * coils), 20):
t = i + degrees
xLoc = centerX + (math.cos(t) * radius)
zLoc = centerZ - (math.sin(t) * radius)
pointStr = (pointStr + " p=(" + str(xLoc) + "," + str(yLoc) + "," + str(zLoc) + "),")
knotStr = (knotStr + "k=(" + str(vectorIndex) + ")")
vectorIndex = i + 1
yLoc = yLoc + yOffset
print pointStr
spiral = cmds.curve(d=float(1.0), pointStr, knotStr)
cmds.rebuildCurve (spiral, ch=1, rpo=1, rt=0, end=1, kr=1, kcp=0, kep=0, kt=0, s=0, d=3, tol=0.001)
return spiral
然后我运行:drawHelix (2.00, 3.00, 5.00)
问题是 Maya 没有将“pointStr”识别为曲线命令的标志,当我打印 pointStr 时,它确实给了我想要的东西,但在如何实际完成这项工作上却苦苦挣扎!