提取无属性小数点的高程点
Set acadApp = GetObject(, "AutoCAD.Application") If Err Then Err.Clear Set acadApp = CreateObject("AutoCAD.Application") If Err Then End End If acadApp.Visible = True Dim acadDoc As AcadDocument acadApp.WindowState = acMax Set acadDoc = acadApp.ActiveDocument Set Excel = GetObject(, "Excel.Application") Set xlSheet = Excel.ActiveWorkbook.Sheets("sheet1") Dim sjx As AcadSelectionSet Set sjx = acadDoc.SelectionSets.Add("ss10") sjx.SelectOnScreen h = sjx.Count h = 0 For i = 0 To h - 1 '删除所有的选择集 Set ssetObj = acadDoc.SelectionSets.Item(0) ssetObj.Delete Next i Dim FilterType(1) As Integer Dim FilterData(1) As Variant FilterType(0) = 0 FilterData(0) = "text" '是圆 FilterType(1) = 8 FilterData(1) = "shuju" '图层是0 Dim mode As Integer mode = acSelectionSetAll sjx.Select mode, , , FilterType, FilterData k = 1 Dim entry As AcadEntity Dim point As Variant Dim hjx As String For Each entry In sjx If entry.ObjectName = "AcDbText" Or entry.ObjectName = "AcDbMText" Then point = entry.InsertionPoint hjx = entry.TextString xlSheet.Cells(k, 1) = Format(point(0), "##0.000") xlSheet.Cells(k, 2) = Format(point(1), "##0.000") xlSheet.Cells(k, 3) = Format(hjx, "##0.0") k = k + 1 End If Next entry |