<?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 get a list of all the layouts from the selected subset? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273069#M3530</link>
    <description>&lt;BLOCKQUOTE&gt;Tsepov wrote:&lt;BR /&gt;learn an example&lt;/BLOCKQUOTE&gt;

It would be nice to have a list of methods in examples with a brief description. It's easy to miss some stuff in examples.</description>
    <pubDate>Wed, 26 Dec 2018 14:23:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-12-26T14:23:50Z</dc:date>
    <item>
      <title>How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273067#M3528</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;The user has selected a subset.&lt;BR /&gt;I need to step by step collect data from the properties of the drawings of this subset.&lt;BR /&gt;How can I get the selected subset?&lt;BR /&gt;How can I get the elements of the selected subset?&lt;BR /&gt;Thank.&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:47:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273067#M3528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-04T14:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273068#M3529</link>
      <description>Sorry))&lt;BR /&gt;
Apparently I need to learn an example.&lt;BR /&gt;
Navigator_Test&lt;BR /&gt;
 &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_redface.gif" style="display : inline;" /&gt;</description>
      <pubDate>Wed, 26 Dec 2018 14:10:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273068#M3529</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-26T14:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273069#M3530</link>
      <description>&lt;BLOCKQUOTE&gt;Tsepov wrote:&lt;BR /&gt;learn an example&lt;/BLOCKQUOTE&gt;

It would be nice to have a list of methods in examples with a brief description. It's easy to miss some stuff in examples.</description>
      <pubDate>Wed, 26 Dec 2018 14:23:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273069#M3530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-26T14:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273070#M3531</link>
      <description>Unfortunately, this is so.&lt;BR /&gt;
The dialog box in the example is not completely unloaded from memory when close.&lt;BR /&gt;
Therefore, it is necessary to reboot ARCHICAD for compilation with the debugger.&lt;BR /&gt;
To avoid this in my work, I work with dialogues through classes of dialog elements.&lt;BR /&gt;
But they are not documented at all now. &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_sad.gif" style="display : inline;" /&gt; &lt;BR /&gt;
So it is very difficult to work.</description>
      <pubDate>Thu, 27 Dec 2018 05:39:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273070#M3531</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-27T05:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273071#M3532</link>
      <description>I need to get selected elements from Navigator by : &lt;BR /&gt;
&lt;BR /&gt;
Int32 DGTreeViewGetSelItems (&lt;BR /&gt;
      short   dialId,&lt;BR /&gt;
      short   item,&lt;BR /&gt;
      Int32*  selItems,&lt;BR /&gt;
      Int32   maxCount&lt;BR /&gt;
    );&lt;BR /&gt;
&lt;BR /&gt;
How I can get Navigator dialogID ?</description>
      <pubDate>Sun, 30 Dec 2018 18:06:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273071#M3532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-30T18:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273072#M3533</link>
      <description>&lt;BLOCKQUOTE&gt;Tsepov wrote:&lt;BR /&gt;How I can get Navigator dialogID ?&lt;/BLOCKQUOTE&gt;

I think it's a wrong direction. Even if I could tell you the dialogID of the Navigator palette, you still need the itemID of the TreeView and finally you will retrieve only the index of the selected items.&lt;BR /&gt;
But anyway, if you choose this solution, then maybe you can use DGGetFocus method to find out the ID of the Navigator and the TreeView:
&lt;PRE&gt;#include "DG.h"

short currDialID;
short currItem;
DGGetFocus (DG_ALL_DIALOGS, &amp;amp;currDialID, &amp;amp;currItem);&lt;/PRE&gt;

&lt;BR /&gt;
Today I wrote a cleaner example code for handling layout book navigator items:
&lt;PRE&gt;#include "Queue.hpp"

using NavItemChildren = GS::Array&amp;lt;API_NavigatorItem&amp;gt;;
using NavItemParentChildrenPair = GS::Pair&amp;lt;API_NavigatorItem, NavItemChildren&amp;gt;;


static NavItemChildren GetNavItemChildren (const API_NavigatorItem&amp;amp; parentItem)
{
    NavItemChildren childrenItems;
    API_NavigatorItem** items = nullptr;
    GSErrCode err = ACAPI_Navigator (APINavigator_GetNavigatorChildrenItemsID, (void*)&amp;amp;parentItem, &amp;amp;items);
    if (err == NoError) {
        Int32 childCount = BMhGetSize ((GSHandle)items) / Sizeof32 (API_NavigatorItem);
        for (Int32 ii = 0; ii &amp;lt; childCount; ++ii) {
            childrenItems.Push ((*items)[ii]);
        }

        BMhKill ((GSHandle *)&amp;amp;items);
    }

    return childrenItems;
}

static API_Guid GetLayoutBookRootGuid ()
{
    API_NavigatorSet  set = {};
    set.mapId = API_LayoutMap;
    ACAPI_Navigator (APINavigator_GetNavigatorSetID, &amp;amp;set, nullptr);

    return set.rootGuid;
}

static GS::HashTable&amp;lt;API_Guid, NavItemParentChildrenPair&amp;gt; GetLayoutBook ()
{
    GS::HashTable&amp;lt;API_Guid, NavItemParentChildrenPair&amp;gt; result;

    API_NavigatorItem item = {};
    item.guid = GetLayoutBookRootGuid ();
    item.mapId = API_LayoutMap;

    GS::Queue&amp;lt;API_NavigatorItem&amp;gt; queue = { item };
    while (queue.IsEmpty () == false) {
        API_NavigatorItem parentItem = queue.Pop ();
        NavItemChildren childrenItems = GetNavItemChildren (parentItem);

        for (const auto&amp;amp; child : childrenItems) {
            queue.Push (child);
        }

        result.Add (parentItem.guid, NavItemParentChildrenPair (parentItem, childrenItems));
    }

    return result;
}

static GS::Array&amp;lt;API_NavigatorItem&amp;gt; GetLayoutSubsets (const GS::HashTable&amp;lt;API_Guid, NavItemParentChildrenPair&amp;gt;&amp;amp; layoutBook)
{
    GS::Array&amp;lt;API_NavigatorItem&amp;gt; subsets;

    for (const NavItemParentChildrenPair&amp;amp; parentChildrenPair : layoutBook.Values ()) {
        if (parentChildrenPair.first.itemType == API_SubSetNavItem)
            subsets.Push (parentChildrenPair.first);
    }

    return subsets;
}

static const NavItemChildren&amp;amp; GetLayoutsFromSubset (const API_Guid&amp;amp; subsetGuid, const GS::HashTable&amp;lt;API_Guid, NavItemParentChildrenPair&amp;gt;&amp;amp; layoutBook)
{
    return layoutBook[subsetGuid].second;
}

// Usage:

const GS::HashTable&amp;lt;API_Guid, NavItemParentChildrenPair&amp;gt; layoutBook = GetLayoutBook ();

for (const auto&amp;amp; subset : GetLayoutSubsets (layoutBook)) {
    const NavItemChildren&amp;amp; layouts = GetLayoutsFromSubset (subset.guid, layoutBook);
    // ...
}&lt;/PRE&gt;
Note, this code works in ARCHICAD 22.&lt;BR /&gt;
If you use previous versions, then you have to replace ACAPI_Navigator with ACAPI_Environment and APINavigator_* with APIEnv_*.&lt;BR /&gt;
There could be other compilation issues also, because of the new C++ standard features, but I think it's better to have here the up-to-date version of the code now.</description>
      <pubDate>Wed, 02 Jan 2019 11:31:12 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273072#M3533</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2019-01-02T11:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273073#M3534</link>
      <description>Thank you so much for the support!&lt;BR /&gt;
I have already made, on the basis of the old example, the basis of an application for counting sheets in a draft equivalent to A4.&lt;BR /&gt;
Now I will try to make the transition button from the selected position to the same position in the navigator and back.&lt;BR /&gt;
To do this, you need to somehow get the ID of the navigator dialog and the ID of the layouts treeview.</description>
      <pubDate>Sun, 06 Jan 2019 18:24:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273073#M3534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-06T18:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of all the layouts from the selected subset?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273074#M3535</link>
      <description>And else problem.&lt;BR /&gt;
I need to get the page orientation for current layout item. &lt;BR /&gt;
I can't find a way to do it.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_cry.gif" style="display : inline;" /&gt;  &lt;BR /&gt;
---------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
API_NavigatorItem** items = nullptr;&lt;BR /&gt;
API_NavigatorItem item;&lt;BR /&gt;
&lt;BR /&gt;
BNZeroMemory(&amp;amp;item, sizeof(API_NavigatorItem));&lt;BR /&gt;
item.guid = guid;&lt;BR /&gt;
item.mapId = mapId;&lt;BR /&gt;
&lt;BR /&gt;
GSErrCode err = ACAPI_Navigator(APINavigator_GetNavigatorChildrenItemsID, &amp;amp;item, &amp;amp;items);&lt;BR /&gt;
if (err != NoError || items == nullptr)&lt;BR /&gt;
	return;&lt;BR /&gt;
&lt;BR /&gt;
Int32 n = BMhGetSize((GSHandle)items) / Sizeof32(API_NavigatorItem);&lt;BR /&gt;
for (Int32 i = 0; i &amp;lt; n; i++) {&lt;BR /&gt;
	if ((*items)&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;.itemType == API_LayoutNavItem)&lt;BR /&gt;
	{&lt;BR /&gt;
                       // &lt;BR /&gt;
		API_LayoutInfo layoutInfo;&lt;BR /&gt;
		ULong actualPageIndex = 0;&lt;BR /&gt;
		API_DatabaseUnId databaseUnId = (*items)&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;.db.databaseUnId;&lt;BR /&gt;
		err = ACAPI_Environment(APIEnv_GetLayoutSetsID, &amp;amp;layoutInfo, &amp;amp;databaseUnId, actualPageIndex);&lt;BR /&gt;
		if (err == GS::NoError)&lt;BR /&gt;
		{&lt;BR /&gt;
                        sizeX =  layoutInfo.sizeX;&lt;BR /&gt;
                        // And there I need to get page orientation-&amp;gt;&lt;BR /&gt;
                        // &amp;lt;-&lt;BR /&gt;
                 }&lt;BR /&gt;
          }&lt;BR /&gt;
 }</description>
      <pubDate>Wed, 09 Jan 2019 11:36:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-a-list-of-all-the-layouts-from-the-selected-subset/m-p/273074#M3535</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-09T11:36:22Z</dc:date>
    </item>
  </channel>
</rss>

