Every database object maintains a list of reactors on itself. Some are transient reactors, and some are persistent. Transient reactors are instances of classes derived from AcDbObjectReactor, whereas persistent reactors are the object IDs of database-resident objects.
The following code shows how to search through the list of reactors to find your transient or persistent reactor. It is extremely important that you verify a particular entry in the reactor list to be a persistent reactor by using the AcDbIsPersistentReactor() function. If it is a persistent reactor, you can use the appropriate function to obtain its object ID. If it is not a persistent reactor, you can cast the entry to AcDbObjectReactor.
AcDbVoidPtrArray *pReactors; void *pSomething; AcDbObjectReactor *pObjReactor; AcDbObjectId persObjId; AcDbObject *pPersReacObj; pReactors = pEnt->reactors(); if (pReactors != NULL && pReactors->length() > 0) { for (int i = 0; i < pReactors->length(); i++) { pSomething = pReactors->at(i); // Is it a persistent reactor? // if (acdbIsPersistentReactor(pSomething)) { persObjId = acdbPersistentReactorObjectId( pSomething); acutPrintf("\n\nPersistent reactor found."); // Echo the keyname to the user. // char *keyname = NULL; getPersReactorKey(keyname, persObjId); if (keyname) { acutPrintf("\nThis is the reactor named %s", keyname); free (keyname); } // Open it up and see if it's one of ours. If it is, // fire the custom notification. // if ((retStat = acdbOpenAcDbObject(pPersReacObj, persObjId, AcDb::kForNotify)) != Acad::eOk) { acutPrintf("\nFailure for" " openAcDbObject: retStat==%d\n", retStat); return; } AsdkPersReactor *pTmpPers; if ((pTmpPers = AsdkPersReactor::cast((AcRxObject*) pPersReacObj)) != NULL) { pTmpPers->custom(); } pPersReacObj->close(); } else { // Or is it transient? // pObjReactor = (AcDbObjectReactor *) (pReactors->at(i)); acutPrintf("\n\nTransient Reactor found"); // Report what kind we found. // if (pObjReactor->isKindOf( AsdkSimpleObjReactor::desc())) { acutPrintf(" of type" " AsdkSimpleObjReactor"); } else if (pObjReactor->isKindOf( AcDbEntityReactor::desc())) { acutPrintf(" of type" " AcDbEntityReactor"); } else if (pObjReactor->isKindOf( AcDbObjectReactor::desc())) { acutPrintf(" of type" " AcDbObjectReactor"); } else { acutPrintf(" of unknown type."); } } } } else { acutPrintf("\nThis entity has no reactors.\n"); }