By Adam Nagy
Side database (or non-working database) is the database of a drawing loaded into memory in the background, i.e. the database of a drawing which is not visible in the UI.
Though AutoCAD Mechanical supports API interaction with side databases, you might run into issues if you try to save a side database. So the best is to avoid that by opening up the document as normal and interact with them programmatically that way.
If you still want to modify and save a drawing in the background then you could open a new AutoCAD instance (acad.exe) in the background that will open the drawing normally and interact with that programmatically (similar how background printing works). You do not have to use COM Automation for it: if the process is started with the appropriate parameters then it could run a script, or some add-in could be set up of autoload that would execute the required actions.
Some notes from the SDK readme file:
In ACM, the non-working database must be created without associating to the current document. When create AcDbDatabase object, in the AcDbDatabase constructor, you need to set the second parameter, noDocument to true.
Non-working Database
· To use the function, AcDbDatabase::readDwgFile() to open a non-working database, you have to start a transaction first.
· If there are xref drawings attached to a non-working database, then for xref databases to be loaded and resolved, the application must explicitly call the function, acdbResolveCurrentXRefs(). This will ensure that all the xref databases are properly loaded. If the xrefs needs to be redirected, then XLOADCTL needs to be set to 1 prior to calling acdbResolveCurrentXRefs, otherwise the database will not be properly initialized.
· To use the function, amiGetDrawingType() in a non-working database, the non-working database must be created without associating to the current document. When create AcDbDatabase object, in the AcDbDatabase constructor, you need to set the second parameter, noDocument to true.
· To use the function, amiGetKeyFromId() in a non-working database, you have to open a transaction in the non-working database.