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