2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations
2019-11-07
12:04 PM
- last edited on
2022-09-29
10:02 AM
by
Daniel Kassai
ACAPI_CallUndoableCommand("Import Files", [&]() -> GSErrCode { ImportFiles(); return (0); }); void ImportFiles() { ... ACAPI_Automate(APIDo_SaveID); }Is there a way to get out of this scope or I have to call it outside ImportFiles?
Solved! Go to Solution.
2019-11-08 03:08 PM
2019-11-08 03:08 PM
2019-11-08 04:56 PM
API_NewProjectPars npp; BNZeroMemory(&npp, sizeof(API_NewProjectPars)); npp.newAndReset = true; npp.enableSaveAlert = false; GSErrCode err = ACAPI_Automate(APIDo_NewProjectID, &npp);If I manually open a new project, ARCHICAD 23 Template.tpl is choosen and everything is OK.
2019-11-26 09:28 AM
2022-03-02 06:08 PM
Tibor,
If I understand this correctly, this prevents me from creating a custom menu [AC23] with a choice that updates all drawings and saves. I understand I have to reserve before I can save a Teamwork file. However, I am the only one working in a non-Teamwork .pln file. I am using Do_Save_Plan() found in the AC23 Examples Automate_Functions.cpp file.
It would also be unclear to me if I cannot call this from inside the ACAPI_CallUndoableCommand scope of MenuCommandHandler(), how exactly would I execute my update instructions and save my work?
Currently, when I try this, I get err = -2130312312
GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *params)
{
return ACAPI_CallUndoableCommand("JHP_BatchPdf Menu Command", [&]() -> GSErrCode {
switch (params->menuItemRef.menuResID)
{
case JHP_BATCHPDF_MENU_STRINGSID: {
switch (params->menuItemRef.itemIndex)
{
case 1: {
ACAPI_WriteReport("Refresh", true);
RefreshAllLayoutBooks();
break;
}
case 2: {
ACAPI_WriteReport("Save project", true);
Do_Save_Plan();
break;
}
case 3: {
ACAPI_WriteReport("Save PDF", true);
Do_Save_PdfFile();
break;
}
}
}
}
return NoError;
});
}
// -----------------------------------------------------------------------------
// Save the current project
// -----------------------------------------------------------------------------
static void Do_Save_Plan(void)
{
GSErrCode err;
err = ACAPI_Automate(APIDo_SaveID);
if (err != NoError)
// ACAPI_WriteReport("Error in APIDo_SaveID: %s", true, ErrID_To_Name(err));
ACAPI_WriteReport("Error in APIDo_SaveID: %d", true, err);
return;
} // Do_Save_Plan
Thanks for any hint you can provide,
Chris