I could have sworn that I covered this subject on "Without a Net" in the past but it seems I was wrong. Since this is a subject that still comes up from time (I was talking with someone about it today, in fact), I'll cover it now.
Maybe you’re heard the term “regapp” before but have no idea what it means? Regapp is short for “registered application”. Using one of the Autodesk-provided APIs (AutoLISP, ObjectARX, etc.) it’s possible to attach Extended Entity Data (aka XData) to objects in a drawing. This XData allows different types of information to be associated with specific objects and helps extend data storage options in AutoCAD. XData has been around for a very long time and is still used quite often because of it’s efficiency (with small amounts of data) and it’s simplicity to write.
XData is grouped by registered application name and a registered application name is required by AutoCAD in order to identify the XData. In order for an application to store and retrieve XData, it must reference a unique regapp ID. Thus, a regapp name (or ID) is an identifier of XData that that is (or was) attached to objects in the drawing. You can see what regapp IDs might exist in your drawings by running the following LISP:
(defun c:ListRegappIDs (/ appname)
(if (setq appname (tblnext "appid" T))
(princ "\nRegistered application IDs in drawing:")
)
(while appname
(princ (strcat "\n" (cdr (assoc 2 appname))))
(setq appname (tblnext "appid"))
)
(princ)
)
Running this LISP function on even a blank drawing will usually show a small handful of registered application names. Any regapp name that begins with ACAD, e.g., AcadAnnotative, indicates an application created by Autodesk. Autodesk has always encouraged developers to use regapp names with a prefix that is unique and specific to the creator of the regapp. This helps avoid potential collisions with other regapp names and helps identify the author of those regapps. Of course, this recommendation is not always followed and you can end up with a lot of regapp IDs and no way of knowing who created them or what their purpose is. Autodesk creates an easily identifiable and conservative amount of regapp IDs but many third-party developers create them by the hundreds or thousands to store application-specific data – and often without any clear way of identifying where they came from.
Chances are that many of the regapp IDs you see are still in use and being referenced by objects in your drawing … but maybe not. Unfortunately, when objects with attached xdata are deleted from a drawing, the regapp IDs persist in the Application ID (APPID) symbol table until they are manually purged from the database. This is where we get to the heart of the topic.
The Problem with Excess Regapp IDs
Excess unreferenced regapp IDs can have a negative impact on your drawing files. These orphaned IDs can add considerable size to drawing files and can slow performance – especially on operations such as loading, plotting, eTransmit or any operation that requires scanning the drawing database. A customer once sent me a drawing that contained 109,337 regapp IDs and was 2,374,138 bytes in size. After I purged the unreferenced regapp IDs from the drawing I was left with only 46 referenced regapp IDs and the resulting drawing size dropped to 459,904 bytes. Let that sink in for a moment …
That single drawing contained over 109,000 unreferenced regapp IDs that were responsible for 80% of the drawings size.
To make matters worse, regapp IDs can spread through your other drawings. If you xref attach a drawing that contains regapp IDs, those IDs are cloned into the host drawing and take up permanent residence in the host. Even after the xref has been detached, the cloned regapp IDs will continue to reside in the host drawing. Imagine a large project on a network where hundreds of drawings all xref a common drawing that contains a lot of unreferenced regapp IDs. After attachment, each of those drawings then contain a copy of all those regapp IDs – whether they need them or not – and each drawing can potentially be affected by the size and performance issues previously described.
The first question I usually hear is, “Why doesn’t Autodesk just provide a system variable that allows me to block the loading of regapp IDs when I open the drawing?” The problem with this approach is that it isn’t safe to allow an arbitrary decision about whether or not to load regapp IDs. Unless these IDs are unreferenced, they are legitimately linked to data stored in the drawing and not loading them could have consequences for Autodesk and 3rd-party applications that rely on those IDs to access their data. It would be like providing a system variable that determines whether or not we load blocks from an xref or resolve an xref at all - this is potentially necessary data that we aren’t in a good position to try and regulate. We could try a load-time operation that only loads those regapp IDs that are actually referenced but this would make the time it takes to load every drawing much, much longer. At this time, the safest way to address this issue is to manually remove unreferenced regapp IDs.
For individual drawings, unreferenced regapp IDs can be purged using the -PURGE command and choosing the Regapp option (note: this option is not available via the Purge dialog displayed by the PURGE command). If you have a lot of drawings, this can quickly become a tedious process as it requires you to load each drawing, one at a time, to run the purge operation. Furthermore, it won’t purge unreferenced regapp IDs within attached xrefs so you still have to clean those drawings separately.
A quicker and more thorough method for cleaning drawings is to use the Regapp ID Cleanup Utility. I've referred to this utility in the past and with it, you can remove unreferenced regapp IDs from multiple drawings (or folders of drawings) AND from any xrefs that are attached to those drawings … and all in one operation. Since the utility runs outside of AutoCAD, it can clean more drawings in far less time than manual purging or even purging using a script.
Because of the way regapp IDs can spread to other drawings during xref attachment, this utility provides a good triage step for companies who get unknown drawings in from consultants and vendors and want ensure they are free of unreferenced regapp IDs before putting them on their networks for public consumption.
Links to the available versions of the Regapp ID Cleanup Utility can be found in this technical solution:
Excess unreferenced regapp IDs causing performance issues