怎么用VBA获得圆的圆心座标呢
各位大侠,怎么用VBA获得圆的圆心座标呢,急需。先谢谢了 <p>Sub GetCenter()<br/>Dim ExcelApp As New Excel.Application<br/>Dim ExcelWkbk As Excel.Workbook<br/>Set ExcelWkbk = ExcelApp.Workbooks.Add<br/>Dim i As Integer<br/>i = 2<br/>Dim Ent As AcadEntity<br/>Dim pt1 As Variant, pt2 As Variant<br/>With ExcelWkbk.Worksheets("Sheet1")<br/> For Each Ent In ThisDrawing.ModelSpace<br/> If Ent.ObjectName = "AcDbCircle" Then<br/> .Range("A" & i) = i - 1<br/> pt1 = Ent.Center<br/> .Range("B" & i) = pt1(0)<br/> .Range("C" & i) = pt1(1)<br/> i = i + 1<br/> End If<br/> Next Ent<br/>End With<br/>ExcelApp.ActiveWorkbook.SaveAs "D:\AcDCenter.xls"<br/>ExcelApp.Workbooks.Close<br/>ExcelApp.Quit</p><p>End Sub<br/>结果在"D:\AcDCenter.xls"里</p> 新手来学习了,多谢分享。
页:
[1]