Application reference missing: AcDbBlockRepETag, to AcDbLine

This VBA tool is a solution to the error Autocad can give while you're attempting to close the reference editor in Autocad and saving the changes you made.

"Application reference missing: AcDbBlockRepETag, to AcDbLine" or similar.

The cause is Xdata attached to elements in the block you are editing, referencing an application that is no longer registered in the drawing. Autocad does not use this XData and you can safely delete it. Just do not delete the XData for application ACAD or your customized dimensions may suddenly go shapeless.

Run this macro while in refeditor if you get the error. Set "check" to True if you want to monitor what is happening, to FALSE if you have a trusting disposition. No cancel button, yet, working on it.




===================================================================================

Public Sub DeleteXData()
Dim alles As AcadSelectionSet
Dim xtype(0) As Integer
Dim mappname, naam As String
Dim element As AcadEntity
Dim check As Boolean

xtype(0) = 1001

Call SelectieSet(alles, "alles")
alles.Select (acSelectionSetAll)
For Each element In alles

element.GetXData "", xtypeOut, xdataOut

On Error Resume Next

check = True

If check Then
If xdataOut(0) <> mappname Then
MsgBox ("Xdata has been attached by application: " & xdataOut(0) & ". ")
End If
If Not (IsEmpty(xtypeOut)) Then
If naam <> element.ObjectName Then
naam = element.ObjectName
MsgBox ("Element name: " & element.ObjectName)
End If
End If
End If

mappname = xdataOut(0)
If mappname <> "ACAD" Then
element.SetXData xtype, Array(mappname)
End If
If Err Then Err.Clear
On Error GoTo 0

Next element
alles.Delete
If Err Then Err.Clear
On Error GoTo 0
End Sub

Public Sub SelectieSet(ss, Name)
On Error Resume Next

Set ss = ThisDrawing.SelectionSets.Add(Name)
If Err Then
Set ss = ThisDrawing.SelectionSets.Item(Name)
ss.Clear
Err.Clear
End If
On Error GoTo 0

End Sub

======================================================================

Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment