<?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: AC17 API - ACAPI_3D_GetCurrentWindowSight in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150378#M5768</link>
    <description>I would like to confirm that the code posted by paulk is indeed incorrect.&lt;BR /&gt;

&lt;PRE&gt;	
Modeler::SightPtr currentSightPtr;
GSErrCode err = ACAPI_3D_GetCurrentWindowSight ((void**)&amp;amp;currentSightPtr);
&lt;/PRE&gt;

A Modeler::SightPtr happens to be a GS::SharedPtr&amp;lt;Sight&amp;gt;, which is not the same as a raw Sight* pointer.&lt;BR /&gt;
&lt;BR /&gt;
Calling the code above will seem to work but in fact will produce memory corruption errors that are difficult to track.&lt;BR /&gt;
&lt;BR /&gt;
Tibor's answer is better, although I have fixed my problem differently:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;        void* dummy = nullptr;
        ACAPI_3D_GetCurrentWindowSight(&amp;amp;dummy);
        Modeler::SightPtr currentSightPtr((Modeler::Sight*)dummy); // init the shared ptr with the raw pointer

        ModelerAPI::Model acModel;
        AttributeReader attrReader;
        EXPGetModel(currentSightPtr, &amp;amp;acModel, &amp;amp;attrReader);
&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Aug 2021 19:41:54 GMT</pubDate>
    <dc:creator>drjustice</dc:creator>
    <dc:date>2021-08-05T19:41:54Z</dc:date>
    <item>
      <title>AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150371#M5761</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;ACAPI_3D_GetCurrentWindowSight parameters have changed from *short to **void. With AC16 a -1 short was return for non-3d sights. What is returned in the void** in AC17 for non-3d sights? Documentation provides no clues. (And I don't have AC17 yet to find out!).&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Aug 2023 12:08:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150371#M5761</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-02T12:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150372#M5762</link>
      <description>You should check the return value of ACAPI_3D_GetCurrentWindowSight before using the sight. In case of non-3d sight it will return APIERR_BADWINDOW I think. The void** parameter won't change.</description>
      <pubDate>Thu, 30 May 2013 09:18:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150372#M5762</guid>
      <dc:creator>PBartke</dc:creator>
      <dc:date>2013-05-30T09:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150373#M5763</link>
      <description>Thank you.</description>
      <pubDate>Mon, 03 Jun 2013 06:46:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150373#M5763</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-03T06:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150374#M5764</link>
      <description>Another sight question.&lt;BR /&gt;
&lt;BR /&gt;
AC16 had a function Modeler::Sight::GetSightPtr (currentWindowSightId) so you can get the SightPtr for the ACAPI_3D_GetCurrentWindowSight.  &lt;BR /&gt;
&lt;BR /&gt;
This call (GetSightPtr ) is no longer present in the AC17 API - how can I achieve the same outcome as in AC16 pls?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 13 Jun 2013 01:11:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150374#M5764</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-13T01:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150375#M5765</link>
      <description>In addition to the above, is ACAPI_3D_GetCurrentWindowSight actually returning a pointer to a Modeler::SightPtr now (int he form of a void **)?  Any details on this appear to be absent from the AC17 API documentation.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 13 Jun 2013 01:39:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150375#M5765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-13T01:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150376#M5766</link>
      <description>To save others some time working this out....the void** returned by ACAPI_3D_GetCurrentWindowSight appears to be in fact a Modeler::SightPtr, so it is possible to do the following:&lt;BR /&gt;

&lt;PRE&gt;	Modeler::SightPtr currentSightPtr;

	GSErrCode err = ACAPI_3D_GetCurrentWindowSight ((void**)&amp;amp;currentSightPtr);&lt;/PRE&gt;

Perhaps this is not in the doco because Modeler::SightPtr is undocumented.</description>
      <pubDate>Thu, 13 Jun 2013 01:53:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150376#M5766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-06-13T01:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150377#M5767</link>
      <description>Hi, &lt;BR /&gt;
 &lt;BR /&gt;
here's a short example code to show how to use ACAPI_3D_GetCurrentWindowSight (and EXPGetModel which has been changed in AC17 API also). &lt;BR /&gt;
 
&lt;PRE&gt;       GSModeler::ModelFuncTable *funcTable = EXPGetModelFunctionTable (); 
       if (funcTable == NULL) 
             return APIERR_CANCEL; 
       GSModeler::Model::SetFuncTable (funcTable); 
  
       void*  currentSightPtr; 
       if (ACAPI_3D_GetCurrentWindowSight (&amp;amp;currentSightPtr) != NoError) 
             return APIERR_CANCEL; 
  
       GSModeler::Model model; 
       Modeler::Sight* sight = static_cast&amp;lt;Modeler::Sight*&amp;gt; (currentSightPtr); 
       if (EXPGetModel (sight-&amp;gt;GetConstMainModelPtr (), sight-&amp;gt;GetSunSettings (), &amp;amp;model) != NoError) 
             return APIERR_CANCEL;&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
Regards, &lt;BR /&gt;
Tibor</description>
      <pubDate>Mon, 17 Jun 2013 12:08:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150377#M5767</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2013-06-17T12:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150378#M5768</link>
      <description>I would like to confirm that the code posted by paulk is indeed incorrect.&lt;BR /&gt;

&lt;PRE&gt;	
Modeler::SightPtr currentSightPtr;
GSErrCode err = ACAPI_3D_GetCurrentWindowSight ((void**)&amp;amp;currentSightPtr);
&lt;/PRE&gt;

A Modeler::SightPtr happens to be a GS::SharedPtr&amp;lt;Sight&amp;gt;, which is not the same as a raw Sight* pointer.&lt;BR /&gt;
&lt;BR /&gt;
Calling the code above will seem to work but in fact will produce memory corruption errors that are difficult to track.&lt;BR /&gt;
&lt;BR /&gt;
Tibor's answer is better, although I have fixed my problem differently:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;        void* dummy = nullptr;
        ACAPI_3D_GetCurrentWindowSight(&amp;amp;dummy);
        Modeler::SightPtr currentSightPtr((Modeler::Sight*)dummy); // init the shared ptr with the raw pointer

        ModelerAPI::Model acModel;
        AttributeReader attrReader;
        EXPGetModel(currentSightPtr, &amp;amp;acModel, &amp;amp;attrReader);
&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Aug 2021 19:41:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150378#M5768</guid>
      <dc:creator>drjustice</dc:creator>
      <dc:date>2021-08-05T19:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150379#M5769</link>
      <description>&lt;BLOCKQUOTE&gt;drjustice wrote:&lt;BR /&gt;
I would like to confirm that the code posted by paulk is indeed incorrect.
&lt;/BLOCKQUOTE&gt;

You are responding to an 8 year old thread... is your comment really about the AC 17 devkit / API ... or about a more recent version?</description>
      <pubDate>Thu, 05 Aug 2021 23:00:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150379#M5769</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2021-08-05T23:00:47Z</dc:date>
    </item>
    <item>
      <title>ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150380#M5770</link>
      <description>I am working on Archicad 24/25 plugin.&lt;BR /&gt;
&lt;BR /&gt;
And I'm sorry about reviving this. I replied because I always assume that if I struggle with something, then others are likely to eventually struggle with it also. &lt;BR /&gt;
&lt;BR /&gt;
And whenever I post questions, if I don't get answers and I eventually figure it out, I will post an answer online to my own question -- again for the same reason. &lt;BR /&gt;
&lt;BR /&gt;
I could be lazy and just leave the thread unanswered with no solution (as many threads here seem to end up) but I actually take the time and make the effort to give back to the community.&lt;BR /&gt;
&lt;BR /&gt;
BTW, I know it's unproductive to complain. But I wish the Archicad API was well documented, but alas this isn't the case most of the time. &lt;BR /&gt;
&lt;BR /&gt;
Like, I don't understand why you have 12 different data structures that do the same thing, in different namespaces, some types that are classes but some that have constructors some that don't, some that use void pointers, some that use templates, some type names that are missing letters, some that you must initialize not with a constructor, but with BNZeroMemory, and that the SDK provides header files that are there for whatever purpose but that we're not allowed to use other than to make things compile, some classes that we are allowed to use but when you call some of their methods you get unresolved externals, and so on...</description>
      <pubDate>Thu, 05 Aug 2021 23:43:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150380#M5770</guid>
      <dc:creator>drjustice</dc:creator>
      <dc:date>2021-08-05T23:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: AC17 API - ACAPI_3D_GetCurrentWindowSight</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150381#M5771</link>
      <description>&lt;BLOCKQUOTE&gt;drjustice wrote:&lt;BR /&gt;
ike, I don't understand why you have 12 different data structures that do the same thing, in different namespaces, some types that are classes but some that have constructors some that don't, some that use void pointers, some that use templates, some type names that are missing letters, some that you must initialize not with a constructor, but with BNZeroMemory, and that the SDK provides header files that are there for whatever purpose but that we're not allowed to use other than to make things compile, some classes that we are allowed to use but when you call some of their methods you get unresolved externals, and so on...
&lt;/BLOCKQUOTE&gt;

You could start a new topic in this Developer Forum about this... legacy API / API documentation.  Some of the things are ancient...and have more modern wrappers now, but are still there for legacy support (without requiring heavy updates to add-on code), others are newer and more object oriented.  Not being a profit center, a full, clean update of the API, data structures and documentation is not likely.  Also, because it relies on proprietary code - and access to the actual product code - it is not something that can be made open source / community-driven either.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your clarification that you are on the 24 and 25 devkits and that the old solutions as well as yours apply there. &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/E&gt;</description>
      <pubDate>Fri, 06 Aug 2021 02:31:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/AC17-API-ACAPI-3D-GetCurrentWindowSight/m-p/150381#M5771</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2021-08-06T02:31:47Z</dc:date>
    </item>
  </channel>
</rss>

