- Sub test()
- Dim SelObj As AcadObject
- Dim SelP, Obj As Variant
- Dim n
- Dim Pnt As AcadPoint
- Dim x, yThisDrawing.Utility.GetEntity SelObj, SelP, "选择块:"Obj = SelObj.Explode
- n = UBound(Obj) '得到块中图元个数
- For i = 0 To n
- If Obj(i).EntityName = "AcDbPoint" Then
- Set Pnt = Obj(i)
- x = Pnt.Coordinates(0) '点x坐标
- y = Pnt.Coordinates(1) '点y坐标
-
- Open "D:\test.txt" For Append As #1 '写入点到文件
- Print #1, "X=" & Str(x) & " " & "Y=" & Str(y)
- Close #1 End If
- NextFor i = 0 To n '删除炸开的图元
- Obj(i).Delete
- NextEnd Sub
|