多段线的长度用什么属性获得?
本帖最后由 作者 于 2003-6-10 18:18:56 编辑多段线和spline的长度用什么属性获得?
Length
不行呀,
直线可以,圆弧用object.arclength多段线和曲线就不知道了
下面的代码:
Sub GetLength()'创建多段线
Dim plineObj As AcadPolyline
Dim points(0 To 14) As Double
'定义点
points(0) = 1: points(1) = 1: points(2) = 0
points(3) = 1: points(4) = 2: points(5) = 0
points(6) = 2: points(7) = 2: points(8) = 0
points(9) = 3: points(10) = 2: points(11) = 0
points(12) = 4: points(13) = 4: points(14) = 0
'在模型空间创建多段线
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ZoomAll
MsgBox "多段线的长度是:" & plineObj.Length
End Sub
运行出错,对象不支持该属性或方法
下面的代码:Sub GetLength()
'创建多段线
Dim plineObj As AcadPolyline
Dim points(0 To 14) As Double
'定义点
points(0) = 1: points(1) = 1: points(2) = 0
points(3) = 1: points(4) = 2: points(5) = 0
points(6) = 2: points(7) = 2: points(8) = 0
points(9) = 3: points(10) = 2: points(11) = 0
points(12) = 4: points(13) = 4: points(14) = 0
'在模型空间创建多段线
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ZoomAll
MsgBox "多段线的长度是:" & plineObj.Length '''此处出错
End Sub
Length属性在2002及以前版本只支持直线,而2004版后增加支持了多段线
详见:http://www.mjtd.com/object/acad2004/idh_length.htmRE
zfbj的程序是对的,我刚运行过。
页:
[1]