Search code examples
c#pythonironpythongrasshopperrhino3d

MissingMemberException: 'Guid' object has no attribute 'length'


I am trying to get the length of a curve but I am getting the message: MissingMemberException: 'Guid' object has no attribute 'length' The same script in C# works perfectly. What is the problem with the python translation? Here is the Documentation.

PYTHON:

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;

Solution

  • I had a quick look at the documentation. I think you should use rhinoscriptsyntax.CurveLength. AddLine returns a Guid rather than a curve object. You can pass the Guid to CurveLength.

    rs.CurveLength(ln)