AutoVBA在繪圖空間創(chuàng)建LINE對(duì)象,代碼如下。
Public Sub creatline()
Dim mylineobject As AcadLine
Dim startpoint(0 To 2) As Double
Dim endpoint(0 To 2) As Double
startpoint(0) = 1
startpoint(1) = 3
startpoint(2) = 2
endpoint(0) = 4
endpoint(1) = 5
endpoint(2) = 4
Set mylineobject = ThisDrawing.ModelSpace.AddLine(startpoint, endpoint)
End Sub
代碼完。
定義一個(gè)創(chuàng)建直線的函數(shù),指定起點(diǎn)和終點(diǎn),然后將其添加到繪圖空間。