Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 缺失成员例外情况:';Guid';对象没有属性';长度';_C#_Python_Ironpython_Grasshopper_Rhino3d - Fatal编程技术网

C# 缺失成员例外情况:';Guid';对象没有属性';长度';

C# 缺失成员例外情况:';Guid';对象没有属性';长度';,c#,python,ironpython,grasshopper,rhino3d,C#,Python,Ironpython,Grasshopper,Rhino3d,我试图获得曲线的长度,但得到的信息是:MissingMemberException:'Guid'对象没有属性'length'C#中的同一脚本工作得很好。python翻译有什么问题?这是你的电话号码 PYTHON: import rhinoscriptsyntax as rs ln = rs.AddLine(pt1, pt2) a = ln b = ln.Length Line ln; ln = new Line(pt1, pt2); A = ln; B = ln.Length; C

我试图获得曲线的长度,但得到的信息是:
MissingMemberException:'Guid'对象没有属性'length'
C#中的同一脚本工作得很好。python翻译有什么问题?这是你的电话号码

PYTHON:

import rhinoscriptsyntax as rs

ln = rs.AddLine(pt1, pt2)

a = ln 
b = ln.Length
Line ln;

ln = new Line(pt1, pt2);

A = ln;
B = ln.Length;
C#:

import rhinoscriptsyntax as rs

ln = rs.AddLine(pt1, pt2)

a = ln 
b = ln.Length
Line ln;

ln = new Line(pt1, pt2);

A = ln;
B = ln.Length;
我快速地看了一眼那张照片。我认为你应该使用
rhinoscriptsyntax.CurveLength
AddLine
返回Guid而不是曲线对象。您可以将Guid传递给
CurveLength

rs.CurveLength(ln)

我正要发这个。很明显,返回的是新行的GUID,而不是行本身。感谢它的工作原理,如果我更改为以下代码:
import Rhino as Rhino ln=Rhino.Geometry.line(pt1,pt2)a=ln b=ln.Length
,在这种情况下,我会收到以下错误消息:
(ArgumentTypeException):预期的Point3d,获取Guid
为什么在这种情况下我还要获取Guid而不是行本身?错误是
ArgumentTypeException
,因此我认为这意味着至少有一个参数
pt1
pt2
是Guid,而不是
Point3d
对象。异常回溯应该告诉您错误发生在哪一行代码上。