<?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: PYTHON API - Favorites in Archicad Python API</title>
    <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259608#M569</link>
    <description>In the same vane as above :&lt;BR /&gt;
&lt;BR /&gt;
I tried compiling the Favorites_Test example and got a huge number of errors -- 973 errors -- basically could not find the standard header files such as: error.h, float.h, correct.h, stdef.h, stdin.h --- etc. etc.&lt;BR /&gt;
&lt;BR /&gt;
All other examples that I tried compile fine without modification. Obviously something was missed in Favorites_Test. Using Download API Development Kit 23 3006 on Windows 10 with VS 2017&lt;BR /&gt;
&lt;BR /&gt;
What do I need to fix?</description>
    <pubDate>Mon, 30 Sep 2019 23:23:24 GMT</pubDate>
    <dc:creator>poco2013</dc:creator>
    <dc:date>2019-09-30T23:23:24Z</dc:date>
    <item>
      <title>PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259606#M567</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello! &lt;BR /&gt;&lt;BR /&gt;Is there a way to obtain the list of folders in the Favorites palette? I saw in the xml of a favorite, there is a &amp;lt;Folder Name="sampleFolderName" /&amp;gt; . So I was wondering if there is any accessibility in the new Python API for this folder name. &lt;BR /&gt;I am listing the favorites and really need to access them as per folders in 'Favorites'.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Dushyant Basson&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Sep 2022 08:14:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259606#M567</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2022-09-29T08:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259607#M568</link>
      <description>Hi Dushyant,&lt;BR /&gt;
&lt;BR /&gt;
The current version of Python API does not able to retrieve the folderhierarchy of the favorites.&lt;BR /&gt;
Currently it’s available only via C++ API. The code below draws the hierarchy of the favorites to the Report window, simply call &lt;B&gt;DrawFavoritesTree &lt;/B&gt; method.&lt;BR /&gt;
(Note, the code was written by using AC23 API.)&lt;BR /&gt;

&lt;PRE&gt;static GS::UniString DrawLevel (USize level)
{
       GS::UniString string;
       for (UIndex ii = 0; ii &amp;lt; level; ++ii)
              string += '\t';
       return string;
}

static GS::UniString DrawItem (const GS::UniString&amp;amp; name, USize level)
{
       return DrawLevel (level) + name + '\n';
}

static GS::UniString DrawFolder (const GS::UniString&amp;amp; folderName,
                                                       const GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt;&amp;amp; subFoldersInFolder,
                                                       const GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt;&amp;amp; favoritesInFolder,
                                                       USize level = 0)
{
       GS::UniString string = DrawItem (folderName, level);

       string.Insert (string.GetLength () - 1, " [");
       ++level;
       if (subFoldersInFolder.ContainsKey (folderName)) {
              for (const GS::UniString&amp;amp; subFolder : subFoldersInFolder[folderName]) {
                     string += DrawFolder (subFolder, subFoldersInFolder, favoritesInFolder, level);
              }
       }
       if (favoritesInFolder.ContainsKey (folderName)) {
              for (const GS::UniString&amp;amp; favorite : favoritesInFolder[folderName]) {
                     string += DrawItem (favorite, level);
              }
       }
       string.Insert (string.GetLength () - 1, " ]");

       return string;
}

static GSErrCode DrawFavoritesTree ()
{
       API_ToolBoxInfo      toolboxInfo = {};
       GSErrCode            err = NoError;

       err = ACAPI_Environment (APIEnv_GetToolBoxInfoID, &amp;amp;toolboxInfo, (void*)(GS::IntPtr) true);

       if (err != NoError)
              return err;

       // Get all favorites
       GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt; favoritesInFolder;
       GS::Array&amp;lt;API_FavoriteFolderHierarchy&amp;gt; folders;
       for (Int32 ii = 0; ii &amp;lt; toolboxInfo.nTools; ++ii) {
              const API_ToolBoxItem&amp;amp; toolBoxItem = (*toolboxInfo.data)[ii];

              GS::Array&amp;lt;API_FavoriteFolderHierarchy&amp;gt; foldersForTool;
              GS::Array&amp;lt;GS::UniString&amp;gt; favoriteNames;
              ACAPI_Favorite_GetNum (toolBoxItem.typeID, toolBoxItem.variationID, nullptr, &amp;amp;foldersForTool, &amp;amp;favoriteNames);
              folders.Append (foldersForTool);

              for (UIndex jj = 0; jj &amp;lt; favoriteNames.GetSize (); ++jj) {
                     favoritesInFolder.Retrieve (foldersForTool[jj].GetLast ()).Push (favoriteNames[jj]);
              }
       }

       BMKillHandle ((GSHandle *)&amp;amp;toolboxInfo.data);

       if (folders.IsEmpty ())
              return APIERR_GENERAL;

       // Build tree from favorites
       GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt; subFoldersInFolder;
       for (const API_FavoriteFolderHierarchy&amp;amp; folderHierarchy : folders) {
              GS::Optional&amp;lt;GS::UniString&amp;gt; parentFolderName;
              for (const GS::UniString&amp;amp; folderName : folderHierarchy) {
                     if (parentFolderName.HasValue ()) {
                           GS::Array&amp;lt;GS::UniString&amp;gt;&amp;amp; subFolders = subFoldersInFolder.Retrieve (parentFolderName.Get ());
                           if (!subFolders.Contains (folderName))
                                  subFolders.Push (folderName);
                     }
                     subFoldersInFolder.Retrieve (folderName);
                     parentFolderName = folderName;
              }
       }

       // Sort folders and favorites in tree
       for (GS::Array&amp;lt;GS::UniString&amp;gt;&amp;amp; subFolders : subFoldersInFolder.Values ()) {
              GS::Sort (subFolders.Begin (), subFolders.End ());
       }
       for (GS::Array&amp;lt;GS::UniString&amp;gt;&amp;amp; favorites : favoritesInFolder.Values ()) {
              GS::Sort (favorites.Begin (), favorites.End ());
       }

       // Draw tree into the Report Window:
       const GS::UniString rootFolderName = folders.GetFirst ().GetFirst ();
       ACAPI_WriteReport (DrawFolder (rootFolderName, subFoldersInFolder, favoritesInFolder), false);

       return err;
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Sep 2019 10:30:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259607#M568</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2019-09-30T10:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259608#M569</link>
      <description>In the same vane as above :&lt;BR /&gt;
&lt;BR /&gt;
I tried compiling the Favorites_Test example and got a huge number of errors -- 973 errors -- basically could not find the standard header files such as: error.h, float.h, correct.h, stdef.h, stdin.h --- etc. etc.&lt;BR /&gt;
&lt;BR /&gt;
All other examples that I tried compile fine without modification. Obviously something was missed in Favorites_Test. Using Download API Development Kit 23 3006 on Windows 10 with VS 2017&lt;BR /&gt;
&lt;BR /&gt;
What do I need to fix?</description>
      <pubDate>Mon, 30 Sep 2019 23:23:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259608#M569</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2019-09-30T23:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259609#M570</link>
      <description>&lt;BLOCKQUOTE&gt;poco2013 wrote:&lt;BR /&gt;
In the same vane as above :&lt;BR /&gt;
&lt;BR /&gt;
I tried compiling the Favorites_Test example and got a huge number of errors -- 973 errors -- basically could not find the standard header files such as: error.h, float.h, correct.h, stdef.h, stdin.h --- etc. etc.&lt;BR /&gt;
&lt;BR /&gt;
All other examples that I tried compile fine without modification. Obviously something was missed in Favorites_Test. Using Download API Development Kit 23 3006 on Windows 10 with VS 2017&lt;BR /&gt;
&lt;BR /&gt;
What do I need to fix?
&lt;/BLOCKQUOTE&gt;

Hi,&lt;BR /&gt;
Have you installed well the Windows SDK? If yes, you should check the Project properties. Check the VC++ Directories page and the Include Directories row. If you open the edit dialogue of the Include directories you see the paths and you can check them if they are correct.&lt;BR /&gt;
&lt;BR /&gt;
But please pay attention to the Subject from now on. This is not a Python related question.</description>
      <pubDate>Tue, 01 Oct 2019 09:03:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259609#M570</guid>
      <dc:creator>MOREH Tamas</dc:creator>
      <dc:date>2019-10-01T09:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259610#M571</link>
      <description>Thanks for the non-response</description>
      <pubDate>Tue, 01 Oct 2019 22:45:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259610#M571</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2019-10-01T22:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259611#M572</link>
      <description>&lt;BLOCKQUOTE&gt;poco2013 wrote:&lt;BR /&gt;Thanks for the non-response&lt;/BLOCKQUOTE&gt;
Bit harsh –&amp;nbsp;Tamas gave you some good leads to check out.</description>
      <pubDate>Wed, 02 Oct 2019 08:18:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259611#M572</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-10-02T08:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259612#M573</link>
      <description>&lt;BLOCKQUOTE&gt;poco2013 wrote:&lt;BR /&gt;
In the same vane as above :&lt;BR /&gt;
&lt;BR /&gt;
I tried compiling the Favorites_Test example and got a huge number of errors -- 973 errors -- basically could not find the standard header files such as: error.h, float.h, correct.h, stdef.h, stdin.h --- etc. etc.&lt;BR /&gt;
&lt;BR /&gt;
All other examples that I tried compile fine without modification. Obviously something was missed in Favorites_Test. Using Download API Development Kit 23 3006 on Windows 10 with VS 2017&lt;BR /&gt;
&lt;BR /&gt;
What do I need to fix?
&lt;/BLOCKQUOTE&gt;

Which edition of VS 2017 did you install? The Community Edition usually requires an additional download of the Windows SDK.&lt;BR /&gt;
&lt;BR /&gt;
Best, Akos</description>
      <pubDate>Wed, 02 Oct 2019 09:38:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259612#M573</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2019-10-02T09:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259613#M574</link>
      <description>Thanks AKOS&lt;BR /&gt;
&lt;BR /&gt;
I am using the Community 2017 version.&lt;BR /&gt;
The real problem is that Graphisoft does not advise of the SDK issue. and apparently ?? different examples require different SDKs. -- Almost all other Examples will compile normally  out of the box which threw me the "curve"&lt;BR /&gt;
&lt;BR /&gt;
I finally figured that out.  Thanks for the very Professional answer.</description>
      <pubDate>Wed, 02 Oct 2019 11:45:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259613#M574</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2019-10-02T11:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259614#M575</link>
      <description>Hi&lt;BR /&gt;
Does the current Python API release (with AC-24) include anything to access the 'Favorites'?&lt;BR /&gt;

&lt;BLOCKQUOTE&gt;Tibor wrote:&lt;BR /&gt;
Hi Dushyant,&lt;BR /&gt;
&lt;BR /&gt;
The current version of Python API does not able to retrieve the folderhierarchy of the favorites.&lt;BR /&gt;
Currently it’s available only via C++ API. The code below draws the hierarchy of the favorites to the Report window, simply call &lt;B&gt;DrawFavoritesTree &lt;/B&gt; method.&lt;BR /&gt;
(Note, the code was written by using AC23 API.)&lt;BR /&gt;

&lt;PRE&gt;static GS::UniString DrawLevel (USize level)
{
       GS::UniString string;
       for (UIndex ii = 0; ii &amp;lt; level; ++ii)
              string += '\t';
       return string;
}

static GS::UniString DrawItem (const GS::UniString&amp;amp; name, USize level)
{
       return DrawLevel (level) + name + '\n';
}

static GS::UniString DrawFolder (const GS::UniString&amp;amp; folderName,
                                                       const GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt;&amp;amp; subFoldersInFolder,
                                                       const GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt;&amp;amp; favoritesInFolder,
                                                       USize level = 0)
{
       GS::UniString string = DrawItem (folderName, level);

       string.Insert (string.GetLength () - 1, " [");
       ++level;
       if (subFoldersInFolder.ContainsKey (folderName)) {
              for (const GS::UniString&amp;amp; subFolder : subFoldersInFolder[folderName]) {
                     string += DrawFolder (subFolder, subFoldersInFolder, favoritesInFolder, level);
              }
       }
       if (favoritesInFolder.ContainsKey (folderName)) {
              for (const GS::UniString&amp;amp; favorite : favoritesInFolder[folderName]) {
                     string += DrawItem (favorite, level);
              }
       }
       string.Insert (string.GetLength () - 1, " ]");

       return string;
}

static GSErrCode DrawFavoritesTree ()
{
       API_ToolBoxInfo      toolboxInfo = {};
       GSErrCode            err = NoError;

       err = ACAPI_Environment (APIEnv_GetToolBoxInfoID, &amp;amp;toolboxInfo, (void*)(GS::IntPtr) true);

       if (err != NoError)
              return err;

       // Get all favorites
       GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt; favoritesInFolder;
       GS::Array&amp;lt;API_FavoriteFolderHierarchy&amp;gt; folders;
       for (Int32 ii = 0; ii &amp;lt; toolboxInfo.nTools; ++ii) {
              const API_ToolBoxItem&amp;amp; toolBoxItem = (*toolboxInfo.data)[ii];

              GS::Array&amp;lt;API_FavoriteFolderHierarchy&amp;gt; foldersForTool;
              GS::Array&amp;lt;GS::UniString&amp;gt; favoriteNames;
              ACAPI_Favorite_GetNum (toolBoxItem.typeID, toolBoxItem.variationID, nullptr, &amp;amp;foldersForTool, &amp;amp;favoriteNames);
              folders.Append (foldersForTool);

              for (UIndex jj = 0; jj &amp;lt; favoriteNames.GetSize (); ++jj) {
                     favoritesInFolder.Retrieve (foldersForTool[jj].GetLast ()).Push (favoriteNames[jj]);
              }
       }

       BMKillHandle ((GSHandle *)&amp;amp;toolboxInfo.data);

       if (folders.IsEmpty ())
              return APIERR_GENERAL;

       // Build tree from favorites
       GS::HashTable&amp;lt;GS::UniString, GS::Array&amp;lt;GS::UniString&amp;gt;&amp;gt; subFoldersInFolder;
       for (const API_FavoriteFolderHierarchy&amp;amp; folderHierarchy : folders) {
              GS::Optional&amp;lt;GS::UniString&amp;gt; parentFolderName;
              for (const GS::UniString&amp;amp; folderName : folderHierarchy) {
                     if (parentFolderName.HasValue ()) {
                           GS::Array&amp;lt;GS::UniString&amp;gt;&amp;amp; subFolders = subFoldersInFolder.Retrieve (parentFolderName.Get ());
                           if (!subFolders.Contains (folderName))
                                  subFolders.Push (folderName);
                     }
                     subFoldersInFolder.Retrieve (folderName);
                     parentFolderName = folderName;
              }
       }

       // Sort folders and favorites in tree
       for (GS::Array&amp;lt;GS::UniString&amp;gt;&amp;amp; subFolders : subFoldersInFolder.Values ()) {
              GS::Sort (subFolders.Begin (), subFolders.End ());
       }
       for (GS::Array&amp;lt;GS::UniString&amp;gt;&amp;amp; favorites : favoritesInFolder.Values ()) {
              GS::Sort (favorites.Begin (), favorites.End ());
       }

       // Draw tree into the Report Window:
       const GS::UniString rootFolderName = folders.GetFirst ().GetFirst ();
       ACAPI_WriteReport (DrawFolder (rootFolderName, subFoldersInFolder, favoritesInFolder), false);

       return err;
}&lt;/PRE&gt;

FavoritesTreeInReportWindow.png
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 22 Jul 2020 10:50:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259614#M575</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2020-07-22T10:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259615#M576</link>
      <description>&lt;BLOCKQUOTE&gt;dushyant wrote:&lt;BR /&gt;Does the current Python API release (with AC-24) include anything to access the 'Favorites'?&lt;/BLOCKQUOTE&gt;
Unfortunately my answer is no. Currently (AC24.3010) the Python API is not able to access any information related to the Favorites.&lt;BR /&gt;
It's in our backlog, but we haven't started to implement it.</description>
      <pubDate>Wed, 22 Jul 2020 11:08:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259615#M576</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2020-07-22T11:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259616#M577</link>
      <description>&lt;BLOCKQUOTE&gt;Tibor wrote:&lt;BR /&gt;
Unfortunately my answer is no. Currently (AC24.3010) the Python API is not able to access any information related to the Favorites.
&lt;/BLOCKQUOTE&gt;

I see that the current version is 3010. PiPy only lists 3004. Any idea when the new versions will be  released and are there any significant additions?</description>
      <pubDate>Wed, 22 Jul 2020 11:47:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259616#M577</guid>
      <dc:creator>poco2013</dc:creator>
      <dc:date>2020-07-22T11:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: PYTHON API - Favorites</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259617#M578</link>
      <description>&lt;BLOCKQUOTE&gt;Tibor wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;dushyant wrote:&lt;BR /&gt;Does the current Python API release (with AC-24) include anything to access the 'Favorites'?&lt;/BLOCKQUOTE&gt;
Unfortunately my answer is no. Currently (AC24.3010) the Python API is not able to access any information related to the Favorites.&lt;BR /&gt;
It's in our backlog, but we haven't started to implement it.
&lt;/BLOCKQUOTE&gt;
Ok, thanks for the update. And any expected timeline for it?&lt;BR /&gt;
Is there any 'release-notes' of this version where we can read what all has been added compared to the last release?</description>
      <pubDate>Wed, 22 Jul 2020 11:51:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/PYTHON-API-Favorites/m-p/259617#M578</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2020-07-22T11:51:21Z</dc:date>
    </item>
  </channel>
</rss>

