AutoCAD VBA绘制一条直线,代码如下。
Public Function CreateLine()
Dim StartPoint(0 To 2) As Double
Dim EndPoint(0 To 2) As Double
StartPoint(0) = 0
StartPoint(1) = 0
StartPoint(2) = 0
EndPoint(0) = 100
EndPoint(1) = 0
EndPoint(2) = 0
With ThisDrawing.ModelSpace
.AddLine StartPoint, EndPoint
.Item(.Count - 1).Update
End With
End Function
代码完。
运行后会沿X轴绘制一条长度100的直线。