我写了我的第一行(在 SO 的帮助下):
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve", rs.filter.curve)
maxd = input("max offset: ")
a = input("first offset: ")
b = input("next offset: ")
if rs.IsCurve(obj):
i=0
while i < maxd:
rs.OffsetCurve( obj, [0,0,0], -i )
i += a
rs.OffsetCurve( obj, [0,0,0], -i )
i += b
现在,我尝试通过插入偏移输入列表来更进一步。但似乎我最后得到了一个无限循环。此外,第一个rs.OffsetCurve()
似乎运行了两次,或者i
没有随着第二个rs.OffserCurve()
while 循环的第一次运行而更新。
import rhinoscriptsyntax as rs
obj = rs.GetObject("Select a curve", rs.filter.curve)
maxd = input("max offset: ")
a = input("first offset: ")
offlist = []
while True:
b = input("next offset or 0 for exit: ")
offlist.append(b)
if b == 0:
break
if rs.IsCurve(obj):
i=0
while i < maxd:
rs.OffsetCurve( obj, [0,0,0], -i )
i = a
c = len(offlist)
k = 0
while k != c:
rs.OffsetCurve( obj, [0,0,0], -i )
i = offlist[k]
k += 1