代码之家  ›  专栏  ›  技术社区  ›  Arthur Mamou-Mani

MissingMemberException:“Guid”对象没有属性“length”

  •  3
  • Arthur Mamou-Mani  · 技术社区  · 12 年前

    我正试图获得曲线的长度,但我得到的信息是: MissingMemberException: 'Guid' object has no attribute 'length' C#中的相同脚本可以完美地工作。python翻译有什么问题?这是 Documentation .

    蟒蛇:

    import rhinoscriptsyntax as rs
    
    ln = rs.AddLine(pt1, pt2)
    
    a = ln 
    b = ln.Length
    

    C编号:

    Line ln;
    
    ln = new Line(pt1, pt2);
    
    A = ln;
    B = ln.Length;
    
    1 回复  |  直到 12 年前
        1
  •  5
  •   Gary Kerr    12 年前

    我快速看了一下 documentation 。我认为你应该使用 rhinoscriptsyntax.CurveLength . AddLine 返回Guid而不是曲线对象。您可以将Guid传递给 CurveLength .

    rs.CurveLength(ln)