<?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 Refresh all layouts with API in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Refresh-all-layouts-with-API/m-p/333015#M1462</link>
    <description>&lt;P&gt;AC23&lt;/P&gt;&lt;P&gt;Refreshing all layouts is a step in a larger task that will ultimately produce a set of .pdf files of each Architectural layout in a model full of mixed discipline layouts.&amp;nbsp; I started with code found &lt;A href="https://community.graphisoft.com/t5/Developer-forum/Update-drawings-programatically/td-p/139503?f=23&amp;amp;t=34600" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With my edits, I have this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void RefreshAllLayoutBooks()
{
	API_DatabaseUnId *dbases = NULL;
	API_DatabaseInfo db_orig, dbLayoutBook;
	GSErrCode err;
	Int32 nDbases = 0;
	Int32 intCount = 0;

	err = ACAPI_Database(APIDb_GetCurrentDatabaseID, &amp;amp;db_orig, NULL);
	if(err != NoError)
		return;

	err = ACAPI_Database(APIDb_GetLayoutDatabasesID, &amp;amp;dbases, NULL);
	if (err == NoError)
		{
		nDbases = BMpGetSize(reinterpret_cast&amp;lt;GSPtr&amp;gt;(dbases)) / sizeof(API_DatabaseUnId);
		for (Int32 ii = 0; ii &amp;lt; nDbases; ++ii)
		{
			BNZeroMemory(&amp;amp;dbLayoutBook, sizeof(API_DatabaseInfo));
			dbLayoutBook.typeID = APIWind_LayoutID;
			dbLayoutBook.databaseUnId = dbases[ii];
			intCount = intCount ++;
			GS::UniString strMsg;
			GS::UniString strBlank;
			if (intCount &amp;lt; 10) {
				strBlank = "   ";
			}
			else if (intCount &amp;lt; 100) {
				strBlank = "  ";
			}
			else if (intCount &amp;lt; 1000) {
				strBlank = " ";
			}
			
			err = ACAPI_Database(APIDb_GetDatabaseInfoID, &amp;amp;dbLayoutBook, NULL);
			if (err == NoError) {
				if (dbLayoutBook.ref != GS::UniString("")) {
					GS::UniString strSheetName = dbLayoutBook.ref;
					if (strSheetName.GetSubstring(0, 1) == "A") {
						strMsg = strBlank + GS::UniString::Printf("%d", intCount);
						strMsg = "..." + strMsg + " " + strSheetName;
						ACAPI_WriteReport(strMsg, false);
					}
				}
				else {
					strMsg = strBlank + GS::UniString::Printf("%d", intCount) + GS::UniString(" N.O.T.H.I.N.G");
					strMsg = "+++" + strMsg;
					ACAPI_WriteReport(strMsg, false);
				}
			}
		}
		ACAPI_Database(APIDb_ChangeCurrentDatabaseID, &amp;amp;dbLayoutBook, nullptr);
		ACAPI_Database(APIDb_RebuildCurrentDatabaseID);
	}
	if (dbases != NULL)
		BMpFree(reinterpret_cast&amp;lt;GSPtr&amp;gt;(dbases));
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The output of the above code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...   2 A002
...   5 A001
+++   7 N.O.T.H.I.N.G
+++   8 N.O.T.H.I.N.G
... 131 A123
... 132 A200
... 133 A311
... 134 A110a
... 135 A101
etc.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This confirms for me that I am on the right track for capturing only the Architectural sheets in the model.&amp;nbsp; And capturing/not processing a sheet that has no discipline assigned to it.&amp;nbsp; [Not sure what that is all about yet].&amp;nbsp; The number between the "..." and the sheet number is only a sequential number that is incremented as I examine each layout for inclusion in the set of Architectural sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble understanding why the update of the layouts with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ACAPI_Database(APIDb_RebuildCurrentDatabaseID)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does not occur.&amp;nbsp; I am verifying the update by adding a couple of random walls and verifying success of this process with a manual update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;my problem:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I believe I have not captured the proper database ID and/or have not set it as current.&amp;nbsp; Maybe the choice of functions used is not correct.&amp;nbsp; I am not sure.&amp;nbsp; Any direction provided would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2022 16:54:34 GMT</pubDate>
    <dc:creator>MudratDetector</dc:creator>
    <dc:date>2022-03-23T16:54:34Z</dc:date>
    <item>
      <title>Refresh all layouts with API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Refresh-all-layouts-with-API/m-p/333015#M1462</link>
      <description>&lt;P&gt;AC23&lt;/P&gt;&lt;P&gt;Refreshing all layouts is a step in a larger task that will ultimately produce a set of .pdf files of each Architectural layout in a model full of mixed discipline layouts.&amp;nbsp; I started with code found &lt;A href="https://community.graphisoft.com/t5/Developer-forum/Update-drawings-programatically/td-p/139503?f=23&amp;amp;t=34600" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With my edits, I have this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void RefreshAllLayoutBooks()
{
	API_DatabaseUnId *dbases = NULL;
	API_DatabaseInfo db_orig, dbLayoutBook;
	GSErrCode err;
	Int32 nDbases = 0;
	Int32 intCount = 0;

	err = ACAPI_Database(APIDb_GetCurrentDatabaseID, &amp;amp;db_orig, NULL);
	if(err != NoError)
		return;

	err = ACAPI_Database(APIDb_GetLayoutDatabasesID, &amp;amp;dbases, NULL);
	if (err == NoError)
		{
		nDbases = BMpGetSize(reinterpret_cast&amp;lt;GSPtr&amp;gt;(dbases)) / sizeof(API_DatabaseUnId);
		for (Int32 ii = 0; ii &amp;lt; nDbases; ++ii)
		{
			BNZeroMemory(&amp;amp;dbLayoutBook, sizeof(API_DatabaseInfo));
			dbLayoutBook.typeID = APIWind_LayoutID;
			dbLayoutBook.databaseUnId = dbases[ii];
			intCount = intCount ++;
			GS::UniString strMsg;
			GS::UniString strBlank;
			if (intCount &amp;lt; 10) {
				strBlank = "   ";
			}
			else if (intCount &amp;lt; 100) {
				strBlank = "  ";
			}
			else if (intCount &amp;lt; 1000) {
				strBlank = " ";
			}
			
			err = ACAPI_Database(APIDb_GetDatabaseInfoID, &amp;amp;dbLayoutBook, NULL);
			if (err == NoError) {
				if (dbLayoutBook.ref != GS::UniString("")) {
					GS::UniString strSheetName = dbLayoutBook.ref;
					if (strSheetName.GetSubstring(0, 1) == "A") {
						strMsg = strBlank + GS::UniString::Printf("%d", intCount);
						strMsg = "..." + strMsg + " " + strSheetName;
						ACAPI_WriteReport(strMsg, false);
					}
				}
				else {
					strMsg = strBlank + GS::UniString::Printf("%d", intCount) + GS::UniString(" N.O.T.H.I.N.G");
					strMsg = "+++" + strMsg;
					ACAPI_WriteReport(strMsg, false);
				}
			}
		}
		ACAPI_Database(APIDb_ChangeCurrentDatabaseID, &amp;amp;dbLayoutBook, nullptr);
		ACAPI_Database(APIDb_RebuildCurrentDatabaseID);
	}
	if (dbases != NULL)
		BMpFree(reinterpret_cast&amp;lt;GSPtr&amp;gt;(dbases));
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The output of the above code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...   2 A002
...   5 A001
+++   7 N.O.T.H.I.N.G
+++   8 N.O.T.H.I.N.G
... 131 A123
... 132 A200
... 133 A311
... 134 A110a
... 135 A101
etc.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This confirms for me that I am on the right track for capturing only the Architectural sheets in the model.&amp;nbsp; And capturing/not processing a sheet that has no discipline assigned to it.&amp;nbsp; [Not sure what that is all about yet].&amp;nbsp; The number between the "..." and the sheet number is only a sequential number that is incremented as I examine each layout for inclusion in the set of Architectural sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble understanding why the update of the layouts with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ACAPI_Database(APIDb_RebuildCurrentDatabaseID)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does not occur.&amp;nbsp; I am verifying the update by adding a couple of random walls and verifying success of this process with a manual update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;my problem:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I believe I have not captured the proper database ID and/or have not set it as current.&amp;nbsp; Maybe the choice of functions used is not correct.&amp;nbsp; I am not sure.&amp;nbsp; Any direction provided would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 16:54:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Refresh-all-layouts-with-API/m-p/333015#M1462</guid>
      <dc:creator>MudratDetector</dc:creator>
      <dc:date>2022-03-23T16:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh all layouts with API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Refresh-all-layouts-with-API/m-p/333379#M1463</link>
      <description>&lt;P&gt;Update Page Layout with Metadata API (using REST API). Hi everyone! I need to add new account custom fields to the account page layout.&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;A href="https://tutuappvip.co/mobdro-download" target="_self"&gt;mobdro&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;A href="https://myfiosgateway.one/" target="_self"&gt;myfiosgateway.one&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 14:18:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Refresh-all-layouts-with-API/m-p/333379#M1463</guid>
      <dc:creator>ramisthand76</dc:creator>
      <dc:date>2022-04-18T14:18:12Z</dc:date>
    </item>
  </channel>
</rss>

