本帖最后由 guohq 于 2011-11-19 23:25 编辑
- Sub WriteCir()
- Dim ss As AcadSelectionSet
- If IsNull(ThisDrawing.SelectionSets.Item("cir")) Then
- Set ss = ThisDrawing.SelectionSets.Add("cir")
- Else
- Set ss = ThisDrawing.SelectionSets.Item("cir")
- ss.Clear
- End If
-
-
- Dim gpCode(0) As Integer
- Dim dataValue(0) As Variant
- gpCode(0) = 0
- dataValue(0) = "Circle"
-
- Dim groupCode As Variant, dataCode As Variant
- groupCode = gpCode
- dataCode = dataValue
-
- ss.Select acSelectionSetAll, , , groupCode, dataCode
-
- Dim cir As AcadCircle, obj As AcadEntity
- Dim pt As Variant
- Dim fso As Object
- Set fso = CreateObject("Scripting.FileSystemObject")
- Dim pfile As Object
- Set pfile = fso.CreateTextFile("c:\ttttt.txt", True)
-
- For Each obj In ss
- Set cir = obj
- pt = cir.Center
- pfile.WriteLine (pt(0) & " " & pt(1))
- Next
-
- pfile.Close
- End Sub
|