您的位置:网站首页 > CAD新闻

AutoVBA获取基本图元对象

时间:2012-02-01 08:27:25 来源:未知

AutoVBA获取基本图元对象,以LINE为例,代码如下。

Public Sub animatedline()
    Dim mylineobject As AcadLine
    Dim startmovevector(0 To 2) As Double
    Dim endmovevector(0 To 2) As Double
    Dim count As Integer, start As Single
    Set mylineobject = ThisDrawing.ModelSpace.Item(0)
    For count = 1 To 10
        startmovevector(0) = count
        startmovevector(1) = count
        startmovevector(2) = count
        endmovevector(0) = count + 1
        endmovevector(1) = count + 1
        endmovevector(2) = count + 1
        mylineobject.Move startmovevector, endmovevector
        start = Timer
        While Timer < start + 0.05
        Wend
        ZoomAll
        mylineobject.Update
    Next
End Sub

代码完。

图元对象就是基本的面向对象的思想,任何一个图元都是一个类的实例,绘图空间是各个类的实例显示的舞台。


相关文章