明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2143|回复: 0

圆弧和直线连接

[复制链接]
发表于 2008-7-12 08:35:00 | 显示全部楼层 |阅读模式

 

 Function ConnectExcel(InputSheetName As String) As Object
   Dim xlApp As Object
   On Error Resume Next
   Set xlApp = GetObject(, "Excel.Application")
   Set ConnectExcel = xlApp.ActiveWorkbook.Sheets(InputSheetName)
End Function

Sub abab()
  Set ee = ConnectExcel("Sheet1")
  Dim lineObj As AcadLine, arcObj As AcadArc
  Dim pp(0 To 2) As Double, ppp(0 To 2) As Double, pppp(0 To 2) As Double
  Dim app(0 To 2) As Double
  With ee
    For ii = 2 To 9
      Select Case Trim(.Cells(ii, 1))
        Case "AcDbLine"
          Set lineObj = ThisDrawing.HandleToObject(.Cells(ii, 2))
          For jj = 0 To 2
            pp(jj) = .Cells(ii, jj + 4).Value
            ppp(jj) = .Cells(ii, jj + 7).Value
          Next jj
          lineObj.StartPoint = pp: lineObj.EndPoint = ppp
          lineObj.color = 1
        Case "AcDbArc"
          Set arcObj = ThisDrawing.HandleToObject(.Cells(ii, 2))
          arcObj.color = 1
          For jj = 0 To 2
            arcObj.StartPoint(jj) = .Cells(ii, jj + 4).Value
            arcObj.EndPoint(jj) = .Cells(ii, jj + 7).Value
            arcObj.Center(jj) = .Cells(ii, jj + 10).Value
            arcObj.StartAngle = .Cells(ii, jj + 11).Value
            arcObj.EndAngle = .Cells(ii, jj + 12).Value
            arcObj.Radius = .Cells(ii, jj + 13).Value
          Next jj
          arcObj.color = 3
      End Select
    Next ii
  End With
End Sub

 

 

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-24 05:09 , Processed in 0.219163 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表