Friday, April 18, 2008

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

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

2 comments:

Anonymous said...

It´s easy to fix this problem.
The only solution I´ve tested is the following:

While editing a block in the whole working space... if you can´t save because it says something like "Application reference missing: AcDbBlockRepETag, to AcDbLine".

You must send out of the block all the objects of the block. Then it can be saved and you have conserved all the objects and lines you have edited while editing previous block.

you can redefine this block later and continue working.

thyme said...

thanks, for posting, but your solution did not work for me. Removing all XData works.