有沒有辦法修改這個腳本,它試圖在操作過程中嘗試填充兩行並導致錯誤,並繼續執行腳本?嘗試例外似乎不起作用。maya + python:在錯誤操作時執行並繼續
import maya.cmds as cmds
cmds.file(new=True, f=True)
# Create a circular fillet (by default) having radius 2.5 between the
# active curves:
a = cmds.curve(d=1, p=[(0, 0, 0), (0, 0, 5)])
b = cmds.curve(d=1, p=[(0, 0, 5), (0, 0, 10)])
c = cmds.curve(d=1, p=[(0, 0, 10), (-5, 0, 10)])
allShapes = [a,b,c]
# do the first fillet
filletA = cmds.filletCurve(a,b, r=1.5)
if cmds.objExists(filletA):
allShapes.append(filletA)
# do the second fillet
filletB = cmds.filletCurve(b,c, r=1.5)
if cmds.objExists(filletB):
allShapes.append(filletB)
print 'ran'
print allShapes
錯誤
# Warning: No curve contact point specified. Using start of curve instead. #
# Warning: No curve contact point specified. Using start of curve instead. #
# Warning: filletCurve1 (Fillet Curve): failed to get normal. #
# Traceback (most recent call last):
# File "<string>", line 12, in <module>
# File "C:\\Users\\Martini\\Desktop\\trash\\fillet_01.py", line 14, in <module>
# filletA = cmds.filletCurve(a,b, r=1.5)
# # RuntimeError: Command filletCurve failed. Open Script Editor for details.
已更新以上爲您 – JokerMartini