AutoVBA获取基本图元对象
2011-05-31 22:06 精诚所至 金石为开 阅读(729) 评论(0) 编辑 收藏 举报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
代码完。
图元对象就是基本的面向对象的思想,任何一个图元都是一个类的实例,绘图空间是各个类的实例显示的舞台。