- 积分
- 111
- 明经币
- 个
- 注册时间
- 2011-11-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
引用excel表格中的第一列数据画多段线,具体代码如下:Public Sub licheng()
Dim excelApp As Excel.Application
Dim excelSheet As Excel.Worksheet
Dim strFile As String
strFile = ThisDrawing.Application.VBE.ActiveVBProject.fileName
Set excelApp = CreateObject("Excel.Application")
excelApp.Visible = True
excelApp.Workbooks.Open Left$(strFile, Len(strFile) - Len("ex01.dvb")) & "\Excel\demo.xls"
Set excelSheet = excelApp.ActiveWorkbook.Sheets("Sheet1")
Dim i As Integer, j As Integer, k As Integer
For j = 1 To 9
For i = 1 To 9
Dim mspace As New clsModelSpace
Dim lichengzx As AcadLWPolyline
Dim lichengzxpoints(1 To 20) As Double
Dim b As Single, a As Single
b = excelSheet.Cells(1, 1).Value - 910
a = excelSheet.Cells(j, 1).Value - b
lichengzxpoints(i * 2 - 1) = a
lichengzxpoints(i * 2) = 245
Next i
Next j
Set lichengzx = mspace.AddLWPolyline(lichengzxpoints, True, 0)
ZoomAll
' 退出Excel应用程序
excelApp.Quit
End Sub
图框有固定的点位,里程标注线想弄成固定点位,起始点为(910,245),按我的想法,应该lichengzxpoints(1)=910,lichengzxpoints(2)=245,以此类推,但是运行程序后出现起始点(0,0)点,终点为(1620,245)的斜线,不知道哪里出错了。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|