<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to call ACAPI_Automate(APIDo_SaveID) inside ACAPI_CallUndoableCommand scope? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/331310#M3213</link>
    <description>&lt;P&gt;Tibor,&lt;/P&gt;&lt;P&gt;If I understand this correctly, this prevents me from creating a custom menu [AC23] with a choice that updates all drawings and saves.&amp;nbsp; I understand I have to reserve before I can save a Teamwork file.&amp;nbsp; However, I am the only one working in a non-Teamwork .pln file.&amp;nbsp; I am using Do_Save_Plan() found in the AC23 Examples Automate_Functions.cpp file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would also be unclear to me if I cannot call this from&amp;nbsp;inside the ACAPI_CallUndoableCommand scope of MenuCommandHandler(), how exactly would I execute my update instructions and save my work?&lt;/P&gt;&lt;P&gt;Currently, when I try this, I get err = -2130312312&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *params)
{
 return ACAPI_CallUndoableCommand("JHP_BatchPdf Menu Command", [&amp;amp;]() -&amp;gt; GSErrCode {
  switch (params-&amp;gt;menuItemRef.menuResID)
  {
   case JHP_BATCHPDF_MENU_STRINGSID: {
    switch (params-&amp;gt;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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any hint you can provide,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 17:08:29 GMT</pubDate>
    <dc:creator>MudratDetector</dc:creator>
    <dc:date>2022-03-02T17:08:29Z</dc:date>
    <item>
      <title>How to call ACAPI_Automate(APIDo_SaveID) inside ACAPI_CallUndoableCommand scope?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269811#M3209</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello guys,&lt;BR /&gt;&lt;BR /&gt;I call a function in ACAPI_CallUndoableCommand scope and inside this function I call ACAPI_Automate(APIDo_SaveID) and ACAPI_Automate is not working:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;ACAPI_CallUndoableCommand("Import Files", [&amp;amp;]() -&amp;gt; GSErrCode { ImportFiles(); return (0); });

void ImportFiles()
{
        ...
        ACAPI_Automate(APIDo_SaveID);
}
&lt;/PRE&gt;
Is there a way to get out of this scope or I have to call it outside ImportFiles?&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Sep 2022 08:02:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269811#M3209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T08:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to call ACAPI_Automate(APIDo_SaveID) inside ACAPI_CallUndoableCommand scope?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269812#M3210</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
APIDo_SaveID is not allowed to be called inside ACAPI_CallUndoableCommand scope.&lt;BR /&gt;
Sorry, you have to call it outside.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Tibor</description>
      <pubDate>Fri, 08 Nov 2019 14:08:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269812#M3210</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2019-11-08T14:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to call ACAPI_Automate(APIDo_SaveID) inside ACAPI_CallUndoableCommand scope?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269813#M3211</link>
      <description>In order not to open a new topic for these automated functions, how can I open a new project with the "rectangle area" in the center? I open a new project using the example and don't have it:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;        API_NewProjectPars npp;

	BNZeroMemory(&amp;amp;npp, sizeof(API_NewProjectPars));
	npp.newAndReset = true;
	npp.enableSaveAlert = false;

	GSErrCode err = ACAPI_Automate(APIDo_NewProjectID, &amp;amp;npp);
	&lt;/PRE&gt;
If I manually open a new project, ARCHICAD 23 Template.tpl is choosen and everything is OK.&lt;BR /&gt;
&lt;BR /&gt;
How can I choose this template with the automated function?</description>
      <pubDate>Fri, 08 Nov 2019 15:56:56 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269813#M3211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-08T15:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to call ACAPI_Automate(APIDo_SaveID) inside ACAPI_CallUndoableCommand scope?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269814#M3212</link>
      <description>Hi!&lt;BR /&gt;
You are right it is currently not possible.&lt;BR /&gt;
I register it in our issue tracking database and we will implement as soon as we can.&lt;BR /&gt;
Thank you for the report.</description>
      <pubDate>Tue, 26 Nov 2019 08:28:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/269814#M3212</guid>
      <dc:creator>MOREH Tamas</dc:creator>
      <dc:date>2019-11-26T08:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to call ACAPI_Automate(APIDo_SaveID) inside ACAPI_CallUndoableCommand scope?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/331310#M3213</link>
      <description>&lt;P&gt;Tibor,&lt;/P&gt;&lt;P&gt;If I understand this correctly, this prevents me from creating a custom menu [AC23] with a choice that updates all drawings and saves.&amp;nbsp; I understand I have to reserve before I can save a Teamwork file.&amp;nbsp; However, I am the only one working in a non-Teamwork .pln file.&amp;nbsp; I am using Do_Save_Plan() found in the AC23 Examples Automate_Functions.cpp file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would also be unclear to me if I cannot call this from&amp;nbsp;inside the ACAPI_CallUndoableCommand scope of MenuCommandHandler(), how exactly would I execute my update instructions and save my work?&lt;/P&gt;&lt;P&gt;Currently, when I try this, I get err = -2130312312&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *params)
{
 return ACAPI_CallUndoableCommand("JHP_BatchPdf Menu Command", [&amp;amp;]() -&amp;gt; GSErrCode {
  switch (params-&amp;gt;menuItemRef.menuResID)
  {
   case JHP_BATCHPDF_MENU_STRINGSID: {
    switch (params-&amp;gt;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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any hint you can provide,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 17:08:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-call-ACAPI-Automate-APIDo-SaveID-inside-ACAPI/m-p/331310#M3213</guid>
      <dc:creator>MudratDetector</dc:creator>
      <dc:date>2022-03-02T17:08:29Z</dc:date>
    </item>
  </channel>
</rss>

