好久没看101教程,今天看到这一步又卡住了,特来请教大家啊。
我想让每次缩放后形成的图形都显示在rhino窗口中,该如何添加代码呢?
import rhinoscriptsyntax as rs
def fitcurvetolength():
curve_id = rs.GetObject("Select a curve to fit to length", rs.filter.curve, True, True)
if curve_id is None: return
length = rs.CurveLength(curve_id)
length_limit = rs.GetReal("Length limit", 0.5 * length, 0.01 * length, length)
if length_limit is None: return
while True:
if rs.CurveLength(curve_id)<=length_limit: break
curve_id = rs.ScaleObject(curve_id, (0,0,0), (0.95, 0.95, 0.95))
print "New curve length: ", rs.CurveLength(curve_id)
fitcurvetolength()
|