AutoCAD VBA 简单的绘制一条直线
2011-03-19 20:27 精诚所至 金石为开 阅读(567) 评论(0) 编辑 收藏 举报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的直线。
![](https://img2024.cnblogs.com/blog/35695/202502/35695-20250207193659673-708765730.jpg)