源代码
Dim NewObject As AcadDocument Dim FileName As String Dim Number As Double Dim i As Integer Dim Point1(0 To 2) As Double Dim Point2(0 To 2) As Double Dim Line As AcadLine Number = 10 i = 1 Do While i <= Number Point1(0) = 0: Point1(1) = 0: Point1(2) = 0 Point2(0) = i * 100: Point2(1) = 0: Point2(2) = 0 Set NewObject = ThisDrawing.Application.Documents.Add Set Line = ThisDrawing.ModelSpace.AddLine(Point1, Point2) ThisDrawing.Application.ZoomExtents FileName = "D:\" & i & ".dwg" NewObject.SaveAs FileName NewObject.Close False i = i + 1 Loop End Sub
我的目的是画一条直线保存一个DWG文件,一共循环10次。为什么运行的时候老是会卡住,就是循环不能真确的完成,请高手指点一下。 |