兰州人 发表于 2008-7-12 08:35:00

圆弧和直线连接

<p></p><p>&nbsp;</p><p>&nbsp;Function ConnectExcel(InputSheetName As String) As Object<br/>&nbsp;&nbsp; Dim xlApp As Object<br/>&nbsp;&nbsp; On Error Resume Next<br/>&nbsp;&nbsp; Set xlApp = GetObject(, "Excel.Application")<br/>&nbsp;&nbsp; Set ConnectExcel = xlApp.ActiveWorkbook.Sheets(InputSheetName)<br/>End Function</p><p>Sub abab()<br/>&nbsp; Set ee = ConnectExcel("Sheet1")<br/>&nbsp; Dim lineObj As AcadLine, arcObj As AcadArc<br/>&nbsp; Dim pp(0 To 2) As Double, ppp(0 To 2) As Double, pppp(0 To 2) As Double<br/>&nbsp; Dim app(0 To 2) As Double<br/>&nbsp; With ee<br/>&nbsp;&nbsp;&nbsp; For ii = 2 To 9<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select Case Trim(.Cells(ii, 1))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "AcDbLine"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set lineObj = ThisDrawing.HandleToObject(.Cells(ii, 2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For jj = 0 To 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pp(jj) = .Cells(ii, jj + 4).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ppp(jj) = .Cells(ii, jj + 7).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next jj<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lineObj.StartPoint = pp: lineObj.EndPoint = ppp<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lineObj.color = 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Case "AcDbArc"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set arcObj = ThisDrawing.HandleToObject(.Cells(ii, 2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.color = 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For jj = 0 To 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.StartPoint(jj) = .Cells(ii, jj + 4).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.EndPoint(jj) = .Cells(ii, jj + 7).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.Center(jj) = .Cells(ii, jj + 10).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.StartAngle = .Cells(ii, jj + 11).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.EndAngle = .Cells(ii, jj + 12).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.Radius = .Cells(ii, jj + 13).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next jj<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arcObj.color = 3<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Select<br/>&nbsp;&nbsp;&nbsp; Next ii<br/>&nbsp; End With<br/>End Sub<br/></p><p>&nbsp;</p><p>&nbsp;</p>
页: [1]
查看完整版本: 圆弧和直线连接