Share

acdbSetReferenced

C++

Acad::ErrorStatus acdbSetReferenced(
    AcDbObjectId objId
);

File

dbmain.h

Description

This function is used to prevent the automatic purging of anonymous blocks which are created while a drawing is being loaded (that is, created during AcEditorReactor::dwgFileOpened() notification) and there is no AcDbBlockReference object set to reference them. The problem is that purging of anonymous blocks occurs after the AcEditorReactor::dwgFileOpened() notification, so such blocks will be purged since they are unreferenced.

To prevent purging of anonymous blocks created at AcEditorReactor::dwgFileOpened() notification time, there are two alternatives:

  1. The preferred method is to create AcDbBlockReferences that reference the anonymous block definitions. This then sets up an actual reference that prevents purging in the immediate future and beyond.
  1. The alternative (which is not recommended) is to use the acdbSetReferenced() function immediately after the creation of such blocks in order to mark the BlockTableRecords as being referenced so that they will not be purged.

To use this function, an anonymous AcDbBlockTableRecord's object ID is passed in via objId. If the BlockTableRecord is successfully marked as referenced, Acad::eOk will be returned.

Parameters

Parameters Description
objId Input object ID of the anonymous block to mark as referenced

Was this information helpful?