External Reference Pre- and Post-Processing

External reference (xref) pre- and post-processing makes it possible to restore an attached xref's in-memory AcDbDatabase so that it can be saved back to a file. During xref resolve, many symbol table records are mangled, and some are erased. Historically, this was done to simplify the resolve process, and was acceptable because the databases were read-only. This processing makes it possible to temporarily reverse the resolve changes so that the xref database can be modified and written back to its file.

The functions that aid in pre- and post-processing are added to AcDbDatabase. They include a utility function to find the associated block table record from an xref database, as well as the ability to restore the resolved xref, and to reset it back to the proper resolved condition after restoration.

The customary usage for these functions would be to do the restore to the original symbols, make the modifications to the database, save the database, and then restore the forwarded symbols. These steps must be written into a single block of code, to prevent attempts to regenerate the host drawing, execute any xref commands, or provide user prompts while the xref database is in its restored condition.

The functions are