Handling Hard References to AcDbEntities During wblockClone(): CASE 2

The previous example will only work when the reference is in an entity, and that entity is always in the same block table record as the referenced entity. Because they are in the same block table record, the setting of isPrimary for the referring entity will also be valid for the referenced entity. However, if the referenced entity can exist in a different block table record, or if the referring entity is an AcDbObject, you must use other means to determine if appending should be done.

First, you will need to check the WBLOCK notification to determine which type of WBLOCK is occurring, probably by setting a global flag that can then be queried by your wblockClone() function:

Finally, it should be noted that setting up a hard reference to an AcDbEntity is not currently supported by the AcDbProxyObject system, even if you use an AcDbHardPointerId for the reference. AcDbProxyObject uses the default wblockClone() implementation, and thus will not do the append of any referenced entities during either form of WBLOCK. If a WBLOCK happens when your entities are proxies, the references will get cloned, but without the append they will be ownerless and are not persistent. The result is that when the wblocked drawing gets loaded, your reference ID will be NULL, and the referenced entity will be missing. You must code your custom object to handle this situation gracefully.