我想通过IronPython从Curve.Trim(CurveEnd, Double)
API调用RhinoCommon方法。我怎样才能确保我没有获得Curve.Trim(Double, Double)
的重载?
crv.Trim(geo.CurveEnd.End, 8.8)
#raised: Message: expected float, got CurveEnd
注意:如果您想自己尝试一下,则需要安装trial version of Rhino。它包括一个Python编辑器。
编辑/添加: Jeff提到的.Overloads
属性也不起作用。用于测试的代码段:
import rhinoscriptsyntax as rs
import Rhino.Geometry as geo
import System
# first draw a curve longer than 8.8 units
crvO = rs.GetObject() # to pick that curve on the 3d GUI screen
crv = rs.coercecurve(crvO) # to get Rhino.Geometry.Curve
# these both don't work:
crv.Trim(geo.CurveEnd.End, 8.8)
#Message: expected float, got CurveEnd
crv.Trim.Overloads[geo.CurveEnd, System.Double](geo.CurveEnd.End, 8.8)
#Message: Trim() takes at least 2147483647 arguments (2 given)
的Rhino命名空间的库
答案 0 :(得分:4)
答案 1 :(得分:1)
我迟到了。但是此代码有效(超出覆盖范围)。
import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import System
crv_id = rs.GetObject()
crv = rs.coercecurve(crv_id)
trimmed = crv.Trim(Rhino.Geometry.CurveEnd.End, 4)
sc.doc.Objects.Replace(crv_id, trimmed)
sc.doc.Views.Redraw()