Sub DeleteBlock() Dim ObjBlockRef As AcadBlockReference Dim FilterType(0) As Integer, FilterData(0) As Variant Dim sset As AcadSelectionSet
'选中名为"椅子"的块参照并删除 Set sset = ThisDrawing.SelectionSets.Add("test") FilterType(0) = 2 FilterData(0) = "椅子" sset.Select acSelectionSetAll, , , FilterType, FilterData For Each ObjBlockRef In sset ObjBlockRef.Delete Next sset.Delete
'删除块定义 ThisDrawing.Blocks.Item("椅子").Delete End Sub
Sub DeleteBlock() Dim ObjBlockRef As AcadBlockReference Dim FilterType(0) As Integer, FilterData(0) As Variant Dim sset As AcadSelectionSet
'选中名为"椅子"的块参照并删除 Set sset = ThisDrawing.SelectionSets.Add("test") FilterType(0) = 2 FilterData(0) = "椅子" sset.Select acSelectionSetAll, , , FilterType, FilterData For Each ObjBlockRef In sset ObjBlockRef.Delete Next sset.Delete
'删除块定义 ThisDrawing.Blocks.Item("椅子").Delete End Sub