Sub ReSetBlockReference() '恢复块定义 On Error Resume Next Dim blockEnt As AcadBlockReference Dim blkName As String Dim getobj As Object Dim p As Variant Dim i As Integer Dim ssetObj As AcadSelectionSet If Not IsNull(ThisDrawing.SelectionSets.item("Example")) Then Set ssetObj = ThisDrawing.SelectionSets.item("Example") ssetObj.Delete End If Set ssetObj = ThisDrawing.SelectionSets.Add("Example") ThisDrawing.Utility.InitializeUserInput 0, ssetObj.SelectOnScreen For i = 0 To ssetObj.count - 1 Set blockEnt = ssetObj(i) blockEnt.Name = blockEnt.Name Next ssetObj.Delete End Sub |