why NotificationHandler of ACAPI_ProjectOperation_CatchProjectEvent get zero body?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2025-05-22 10:56 AM
Hi, everyone:
first, this is part of my code:
static GSErrCode NotificationHandler(API_NotifyEventID notifID, Int32 param)
{
char msgStr[256];
switch (notifID) {
case APINotify_New: CHCopyC("APINotify_New", msgStr); break;
case APINotify_NewAndReset: CHCopyC("APINotify_NewAndReset", msgStr); break;
case APINotify_Open: CHCopyC("APINotify_Open", msgStr); break;
case APINotify_PreSave: CHCopyC("APINotify_PreSave", msgStr); break;
case APINotify_Save: CHCopyC("APINotify_Save", msgStr); break;
case APINotify_Close: CHCopyC("APINotify_Close", msgStr); break;
case APINotify_Quit: CHCopyC("APINotify_Quit", msgStr); break;
case APINotify_SendChanges: CHCopyC("APINotify_SendChanges", msgStr); break;
case APINotify_ReceiveChanges: CHCopyC("APINotify_ReceiveChanges", msgStr); break;
case APINotify_ChangeProjectDB: CHCopyC("APINotify_ChangeProjectDB", msgStr); break;
case APINotify_ChangeWindow: CHCopyC("APINotify_ChangeWindow", msgStr); break;
case APINotify_ChangeFloor: CHCopyC("APINotify_ChangeFloor", msgStr); break;
case APINotify_ChangeLibrary: CHCopyC("APINotify_ChangeLibrary", msgStr); break;
case APINotify_AllInputFinished: CHCopyC("APINotify_AllInputFinished", msgStr); break;
}
//
void* origSight;
auto err = ACAPI_Sight_SelectSight(nullptr, &origSight);
if (err != NoError) {
//ErrorBeep("Cannot switch to the 3D sight", err);
ACAPI_WriteReport("Cannot switch to the 3D sight", true);
return err;
}
//
{
Int32 nbody;
err = ACAPI_ModelAccess_GetNum (API_BodyID, &nbody);// nbody is zero, but there are many elements
}
ACAPI_WriteReport(msgStr, true);
return NoError;
} // NotificationHandler
API_AddonType CheckEnvironment (API_EnvirParams* envir)
{
RSGetIndString (&envir->addOnInfo.name, ID_ADDON_INFO, 1, ACAPI_GetOwnResModule ());
RSGetIndString (&envir->addOnInfo.description, ID_ADDON_INFO, 2, ACAPI_GetOwnResModule ());
return APIAddon_Preload;// this is important
} // CheckEnvironment
GSErrCode Initialize (void)
{
auto err = ACAPI_ProjectOperation_CatchProjectEvent(APINotify_AllInputFinished, NotificationHandler);
return NoError;
} // Initialize
my goal is to get geometry of all elements in NotificationHandler,but it does not works, the count of Body i get is zero.
so, what's wrong with the code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2025-05-29 09:35 AM
To supplement the explanation to the readers, I am currently using ACAPI_Notification_CatchViewEvent(APINotifyView_Opened, API_PublicViewMap, ViewNotificationHandlerProc) Replaced ACAPI_ProjectOperation_CatchProjectEvent(APINotify_AllInputFinished, NotificationHandler),
The timing of the ViewNotificationHandlerProc trigger is later, which is more in line with my needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2025-05-29 11:07 AM
//
{
API_WindowInfo windowInfo;
API_DatabaseInfo origDB, planDB;
API_Element element;
GS::Array<API_Guid> elemList;
GSErrCode err;
BNZeroMemory(&planDB, sizeof(API_DatabaseInfo));
planDB.typeID = APIWind_3DModelID;
//ACAPI_Database(APIDb_GetCurrentDatabaseID, &origDB, nullptr);
ACAPI_Database_ChangeCurrentDatabase(&planDB);
//
BNZeroMemory(&windowInfo, sizeof(API_WindowInfo));
windowInfo.typeID = APIWind_3DModelID;
windowInfo.databaseUnId = planDB.databaseUnId;
err = ACAPI_Window_ChangeWindow(&windowInfo);
}
//
if (err == NoError)
{
bool is_rebuild = true;
ACAPI_View_Rebuild(&is_rebuild);
}
//
{
{
void* origSight;
GSErrCode err;
err = ACAPI_Sight_SelectSight(nullptr, &origSight);
}
//
Int32 nbody;
auto err = ACAPI_ModelAccess_GetNum(API_BodyID, &nbody);
WriteReport_Alert("body num %d", nbody);
}
- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »