xtjtg 发表于 2008-11-22 18:58:00

恳请高手帮忙啊都快疯了。AddSpline怎用使用Closed 属性

真的,帮帮忙!在线等!都研究了两天了,发疯了!
如题,AddSpline怎用使用Closed 属性?
例:Private Sub Command12_Click()
'非有理B样条
    Dim VetPoints(0 To 8) As Double
    Dim anObj As AcadSpline
    Dim Stan(0 To 2) As Double
    Dim Etan(0 To 2) As Double
    VetPoints(0) = 16: VetPoints(1) = 90: VetPoints(2) = 0: VetPoints(3) = 48: VetPoints(4) = 120
    VetPoints(5) = 0: VetPoints(6) = 100: VetPoints(7) = 70: VetPoints(8) = 0
    Stan(0) = 2: Stan(1) = 8: Stan(2) = 0
    Etan(0) = 3: Etan(1) = 1: Etan(2) = 0
    Set anObj = MoSpace.AddSpline(VetPoints, Stan, Etan)
    anObj.Update
    ZoomAll
End Sub
为什么不能直接使用“anobj.closed=true”,系统会提示说“不能给只读属性赋值”
而下面这个例子:
Private Sub Command11_Click()
'创建多段线
    Dim plineObj1 As AcadPolyline
    Dim points(0 To 11) As Double
    points(0) = 10: points(1) = 65: points(2) = 0
    points(3) = 10: points(4) = 80:
    points(6) = 30: points(7) = 80:
    points(9) = 45: points(10) = 80:
    Set plineObj1 = AcadDoc.ModelSpace.AddPolyline(points)
    plineObj.Closed = True
end sub
就可以直接使用“plineObj.Closed = True”,就能闭合。
为什么呢?会的大侠,麻烦帮个忙,不甚感激!

sailorcwx 发表于 2008-11-22 23:54:00

Closed:read-only for spline objects; read-write for all others
You can close the spline so the start point and endpoint are coincident and tangent.

woaishuijia 发表于 2008-11-23 08:49:00

首尾相连自然就闭合了

xtjtg 发表于 2008-11-23 22:33:00

谢谢二楼的。为什么偏偏是spline的closed属性是可读的呢?真是的!那参考书里还说,用close属性,这不是害人的吗?
页: [1]
查看完整版本: 恳请高手帮忙啊都快疯了。AddSpline怎用使用Closed 属性