<?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: APIEnv_SearchNavigatorItemID not working correctly? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278566#M5166</link>
    <description>Hi Akos&lt;BR /&gt;
&lt;BR /&gt;
I have my Addon looping through almost all the views successfully now. &lt;BR /&gt;
Except for schedule view types. &lt;BR /&gt;
&lt;BR /&gt;
Something tells me that schedule views are handled very differently.&lt;BR /&gt;
&lt;BR /&gt;
Any help or hints would be much appreciated &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
    <pubDate>Mon, 24 Apr 2017 07:00:19 GMT</pubDate>
    <dc:creator>Ben Cohen</dc:creator>
    <dc:date>2017-04-24T07:00:19Z</dc:date>
    <item>
      <title>[SOLVED] APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278561#M5161</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi All&lt;BR /&gt;&lt;BR /&gt;I am trying to create an addon that searches through all navigator items and changes various view settings. All is working well but I have found the search is only working for floor plan and perspective view types.&lt;BR /&gt;&lt;BR /&gt;the code below comes directly from the API devkit. It will loop through all the floor plan views. But if you change it to loop through sections - it will not work. (oddly - perspective views seem to work) (also setting db.typeID seems to have no effect)&lt;BR /&gt;&lt;BR /&gt;I am changing this line of code&lt;BR /&gt;item.itemType = &lt;STRONG&gt;API_StoryNavItem;&lt;/STRONG&gt;&lt;BR /&gt;to this&lt;BR /&gt;item.itemType = API_SectionNavItem&lt;BR /&gt;&lt;BR /&gt;which will work with floor plans and perspectives - but nothing else??&lt;BR /&gt;&lt;BR /&gt;any help - much appreciated!! &lt;IMG style="display: inline;" src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" border="0" /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;GSErrCode err = NoError;

API_DatabaseInfo db;
BNZeroMemory (&amp;amp;db, sizeof (API_DatabaseInfo));
db.typeID = APIWind_FloorPlanID;

API_NavigatorView   view;
API_NavigatorItem   parent;
API_NavigatorItem   item;
API_NavigatorItem** items = NULL;

BNZeroMemory (&amp;amp;item, sizeof (API_NavigatorItem));
item.itemType = API_StoryNavItem
item.mapId    = API_PublicViewMap;
db.typeID     = APIWind_FloorPlanID;

err = ACAPI_Environment (APIEnv_SearchNavigatorItemID, &amp;amp;item, &amp;amp;items, NULL);
if (err != NoError || items == NULL)
    return;

char    str[256];
Int32   num;
Int32   n = BMhGetSize ((GSHandle) items) / sizeof (API_NavigatorItem);

ACAPI_WriteReport ("Stories of View Map:", false);

for (Int32 i = 0; i &amp;lt; n; i++) {
    sprintf (str, "%s", (*items)&lt;I&gt;.name);
    ACAPI_WriteReport (str, false);

    BNZeroMemory (&amp;amp;parent, sizeof (API_NavigatorItem));
    parent.mapId = API_PublicViewMap;
    err = ACAPI_Environment (APIEnv_GetNavigatorParentItemID, (*items)&lt;I&gt;.guid, &amp;amp;parent, NULL);
    sprintf (str, " - parent name: %s", parent.name);
    ACAPI_WriteReport (str, false);

    err = ACAPI_Environment (APIEnv_GetNavigatorChildNumID, &amp;amp;parent, &amp;amp;num, NULL);
    sprintf (str, " - number of children of the parent: %d", num);
    ACAPI_WriteReport (str, false);

    BNZeroMemory (&amp;amp;view, sizeof (API_NavigatorView));
    err = ACAPI_Environment (APIEnv_GetNavigatorViewID, &amp;amp;((*items)&lt;I&gt;), &amp;amp;view, NULL);
    if (view.saveLaySet) {
        if (view.layerCombination[0] != 0)
            sprintf (str, " - Layer combination: %s", view.layerCombination);
        else
            sprintf (str, " - Layers individual");
    } else {
        sprintf (str, " - none layers");
    }
    BMhKill ((GSHandle*) &amp;amp;view.layerStats);

    ACAPI_WriteReport (str, false);
}

BMhKill ((GSHandle *) &amp;amp;items);
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jul 2023 18:44:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278561#M5161</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2023-07-12T18:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278562#M5162</link>
      <description>&lt;BLOCKQUOTE&gt;Ben wrote:&lt;BR /&gt;Hi All&lt;BR /&gt;
&lt;BR /&gt;
I am trying to create an addon that searches through all navigator items and changes various view settings. All is working well but I have found the search is only working for floor plan and perspective view types.&lt;BR /&gt;
&lt;BR /&gt;
I am changing this line of code&lt;BR /&gt;
item.itemType = &lt;B&gt;API_StoryNavItem;&lt;/B&gt;&lt;BR /&gt;
to this&lt;BR /&gt;
item.itemType = API_SectionNavItem&lt;BR /&gt;
&lt;BR /&gt;
which will work with floor plans and perspectives - but nothing else??
&lt;/BLOCKQUOTE&gt;
Have you tried varying this line:
&lt;PRE&gt;db.typeID     = APIWind_FloorPlanID;&lt;/PRE&gt;
That line is directing the search toward the floor plan database.</description>
      <pubDate>Fri, 21 Apr 2017 08:12:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278562#M5162</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2017-04-21T08:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278563#M5163</link>
      <description>Hi Ralph&lt;BR /&gt;
&lt;BR /&gt;
Yes I tried that. Interestingly API_PerspectiveNavItem and API_StoryNavItem both work regardless of how db.typeID is set.&lt;BR /&gt;
&lt;BR /&gt;
so if I do this&lt;BR /&gt;
&lt;BR /&gt;
    item.itemType = API_SectionNavItem;         //  API_StoryNavItem;&lt;BR /&gt;
    db.typeID     = APIWind_SectionID;&lt;BR /&gt;
&lt;BR /&gt;
It does not help&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the reply but still no luck &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt;</description>
      <pubDate>Fri, 21 Apr 2017 10:05:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278563#M5163</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2017-04-21T10:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278564#M5164</link>
      <description>&lt;BLOCKQUOTE&gt;Ben wrote:&lt;BR /&gt;Hi Ralph&lt;BR /&gt;
&lt;BR /&gt;
Yes I tried that. Interestingly API_PerspectiveNavItem and API_StoryNavItem both work regardless of how db.typeID is set.&lt;BR /&gt;
&lt;BR /&gt;
so if I do this&lt;BR /&gt;
&lt;BR /&gt;
    item.itemType = API_SectionNavItem;         //  API_StoryNavItem;&lt;BR /&gt;
    db.typeID     = APIWind_SectionID;&lt;BR /&gt;
&lt;BR /&gt;
It does not help&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the reply but still no luck &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt;&lt;/BLOCKQUOTE&gt;

Hi Ben,&lt;BR /&gt;
&lt;BR /&gt;
The solution is to fill the item.db.databaseUnId with the unique ID of the section database you are searching for.&lt;BR /&gt;
You can get all the available section databases with ACAPI_Database (APIDb_GetSectionDatabasesID, ...).&lt;BR /&gt;
&lt;BR /&gt;
Best, Akos</description>
      <pubDate>Sun, 23 Apr 2017 15:54:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278564#M5164</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2017-04-23T15:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278565#M5165</link>
      <description>Thanks Ako's. That did the trick!! &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Mon, 24 Apr 2017 02:12:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278565#M5165</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2017-04-24T02:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278566#M5166</link>
      <description>Hi Akos&lt;BR /&gt;
&lt;BR /&gt;
I have my Addon looping through almost all the views successfully now. &lt;BR /&gt;
Except for schedule view types. &lt;BR /&gt;
&lt;BR /&gt;
Something tells me that schedule views are handled very differently.&lt;BR /&gt;
&lt;BR /&gt;
Any help or hints would be much appreciated &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Mon, 24 Apr 2017 07:00:19 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278566#M5166</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2017-04-24T07:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278567#M5167</link>
      <description>Hi Ben,&lt;BR /&gt;
Yes it is working differently. In this case you don't have to set item.db.databaseUnId.&lt;BR /&gt;
&lt;BR /&gt;
You have to set the followings:&lt;BR /&gt;
item.itemType = API_ScheduleNavItem;&lt;BR /&gt;
item.mapId    = API_PublicViewMap;&lt;BR /&gt;
db.typeID     = API_ZombieWindowID; &lt;BR /&gt;
&lt;BR /&gt;
In addition you also have to set the item.guid2, which is retrived for example if you call APIEnv_GetNavigatorItemID.&lt;BR /&gt;
&lt;BR /&gt;
Best,&lt;BR /&gt;
Regina</description>
      <pubDate>Mon, 24 Apr 2017 10:32:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278567#M5167</guid>
      <dc:creator>Regina Judak</dc:creator>
      <dc:date>2017-04-24T10:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278568#M5168</link>
      <description>Hi Regina&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the info. But unfortunately I have more issues &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;
&lt;BR /&gt;
I set the following as discussed&lt;BR /&gt;
&lt;BR /&gt;
item.itemType = API_ScheduleNavItem; &lt;BR /&gt;
item.mapId = API_PublicViewMap; &lt;BR /&gt;
db.typeID = API_ZombieWindowID; &lt;BR /&gt;
&lt;BR /&gt;
but the search function "APIEnv_SearchNavigatorItemID" will not return the number of schedule views. Like it will with the other view types&lt;BR /&gt;
&lt;BR /&gt;
Any help &lt;B&gt;greatly&lt;/B&gt; appreciated &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Wed, 26 Apr 2017 06:02:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278568#M5168</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2017-04-26T06:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278569#M5169</link>
      <description>Hi Ben,&lt;BR /&gt;
&lt;BR /&gt;
Here is a modification of the Navigator Test addon’s MakeTree function which handles correctly the Schedules and writes the GUID-s and the name in the report window. Please check this and your code.&lt;BR /&gt;
&lt;BR /&gt;
Best, Regina&lt;BR /&gt;

&lt;PRE&gt;static void MakeTree (short dialogID, short	treeItem, Int32 parent, const API_Guid&amp;amp; guid, GS::PagedArray&amp;lt;Int32&amp;gt;&amp;amp; itemsArray, API_NavigatorMapID mapId)
{
	API_NavigatorItem** items = NULL;
	API_NavigatorItem item;

	BNZeroMemory (&amp;amp;item, sizeof (API_NavigatorItem));
	item.guid = guid;
	item.mapId = NavigatorTestGlobals::Instance ().GetNavigatorMapID ();

	GSErrCode err = ACAPI_Environment (APIEnv_GetNavigatorChildrenItemsID, &amp;amp;item, &amp;amp;items);
	if (err != NoError || items == NULL)
		return;

	Int32 n = BMhGetSize ((GSHandle)items) / Sizeof32 (API_NavigatorItem);
	for (Int32 i = 0; i &amp;lt; n; i++) {
		if ((*items)&lt;I&gt;.itemType == API_ScheduleNavItem) {
			API_NavigatorItem** items2 = nullptr;

			char msgStr[256];
			sprintf (msgStr, "GUID: %s, GUID2: %s, name: %s\n",
						 APIGuid2GSGuid ((*items)&lt;I&gt;.guid).ToUniString ().ToCStr ().Get (),
						 APIGuid2GSGuid ((*items)&lt;I&gt;.guid2).ToUniString ().ToCStr ().Get (),
						 (*items)&lt;I&gt;.name);
			ACAPI_WriteReport (msgStr, false);

			(*items)&lt;I&gt;.mapId = mapId;
			err = ACAPI_Environment (APIEnv_SearchNavigatorItemID, &amp;amp;(*items)&lt;I&gt;, &amp;amp;items2);

			Int32 nn = BMhGetSize ((GSHandle) items2) / Sizeof32 (API_NavigatorItem);
			for (Int32 ii = 0; ii &amp;lt; nn; ii++) { 
				sprintf (msgStr, "GUID: %s, Name: %s, \n",
						 APIGuid2GSGuid ((*items2)[ii].guid).ToUniString ().ToCStr ().Get (), (*items2)[ii].name);
				ACAPI_WriteReport (msgStr, false);
			}

			BMhKill ((GSHandle *) &amp;amp;items2);
		}

		Int32 newItem = InsertTreeItem (dialogID, treeItem, parent, (*items)&lt;I&gt;.name, (*items)&lt;I&gt;.uiId, (*items)&lt;I&gt;.guid, (*items)&lt;I&gt;.itemType);
		if (newItem != 0) {
			itemsArray.Push (newItem);
			MakeTree (dialogID, treeItem, newItem, (*items)&lt;I&gt;.guid, itemsArray, mapId);
		}
	}

	BMhKill ((GSHandle *) &amp;amp;items);
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 11:08:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278569#M5169</guid>
      <dc:creator>Regina Judak</dc:creator>
      <dc:date>2017-05-10T11:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: APIEnv_SearchNavigatorItemID not working correctly?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278570#M5170</link>
      <description>Thanks Regina&lt;BR /&gt;
&lt;BR /&gt;
This is fantastic, I now have my addon working perfectly! &lt;BR /&gt;
Thanks for all your help &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;
&lt;BR /&gt;
Happy Days  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 18 May 2017 07:34:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278570#M5170</guid>
      <dc:creator>Ben Cohen</dc:creator>
      <dc:date>2017-05-18T07:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] APIEnv_SearchNavigatorItemID not working correc</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278571#M5171</link>
      <description>Hi Ben,&lt;BR /&gt;
&lt;BR /&gt;
I'm glad it was helpful for you! &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;
&lt;BR /&gt;
Regina</description>
      <pubDate>Thu, 18 May 2017 09:20:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-APIEnv-SearchNavigatorItemID-not-working-correctly/m-p/278571#M5171</guid>
      <dc:creator>Regina Judak</dc:creator>
      <dc:date>2017-05-18T09:20:51Z</dc:date>
    </item>
  </channel>
</rss>

