这可能是一个很好的起点:
- Option Explicit
- Sub main()
- scanDictionary ThisDrawing.Dictionaries
- scanTable ThisDrawing.DimStyles
- scanTable ThisDrawing.Layers
- scanTable ThisDrawing.Linetypes
- scanTable ThisDrawing.TextStyles
- scanObjects
- End Sub
- Sub scanDictionary(ByRef dictionary As Object)
- Dim obj As AcadObject
- For Each obj In dictionary
- If obj.ObjectName Like "AcDbZombie*" Then
- obj.Delete
- Else
- If obj.HasExtensionDictionary Then
- scanDictionary obj.GetExtensionDictionary
- End If
- End If
- Next obj
- Set obj = Nothing
- End Sub
- Sub scanTable(ByRef table As Object)
- Dim obj As Object
- For Each obj In table
- If obj.HasExtensionDictionary Then
- scanDictionary obj.GetExtensionDictionary
- End If
- Next obj
- Set obj = Nothing
- End Sub
- Sub scanObjects()
- Dim block As AcadBlock
- For Each block In ThisDrawing.Blocks
- Dim ent As AcadEntity
- For Each ent In block
- If ent.ObjectName = "AcDbZombieEntity" Then
- ent.Delete
- Else
- If ent.HasExtensionDictionary Then
- scanDictionary ent.GetExtensionDictionary
- End If
- End If
- Next ent
- Set ent = Nothing
- Next block
- Set block = Nothing
- End Sub
|