AC17 API - ACAPI_3D_GetCurrentWindowSight
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-05-26
01:03 PM
- last edited on
2023-08-02
02:08 PM
by
Doreena Deng
Thanks in advance.
- Labels:
-
Add-On (C++)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-05-30 11:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-06-03 08:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-06-13 03:11 AM
AC16 had a function Modeler::Sight::GetSightPtr (currentWindowSightId) so you can get the SightPtr for the ACAPI_3D_GetCurrentWindowSight.
This call (GetSightPtr ) is no longer present in the AC17 API - how can I achieve the same outcome as in AC16 pls?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-06-13 03:39 AM
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-06-13 03:53 AM
Modeler::SightPtr currentSightPtr; GSErrCode err = ACAPI_3D_GetCurrentWindowSight ((void**)¤tSightPtr);Perhaps this is not in the doco because Modeler::SightPtr is undocumented.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2013-06-17 02:08 PM
here's a short example code to show how to use ACAPI_3D_GetCurrentWindowSight (and EXPGetModel which has been changed in AC17 API also).
GSModeler::ModelFuncTable *funcTable = EXPGetModelFunctionTable (); if (funcTable == NULL) return APIERR_CANCEL; GSModeler::Model::SetFuncTable (funcTable); void* currentSightPtr; if (ACAPI_3D_GetCurrentWindowSight (¤tSightPtr) != NoError) return APIERR_CANCEL; GSModeler::Model model; Modeler::Sight* sight = static_cast<Modeler::Sight*> (currentSightPtr); if (EXPGetModel (sight->GetConstMainModelPtr (), sight->GetSunSettings (), &model) != NoError) return APIERR_CANCEL;
Regards,
Tibor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-08-05 09:41 PM
Modeler::SightPtr currentSightPtr; GSErrCode err = ACAPI_3D_GetCurrentWindowSight ((void**)¤tSightPtr);A Modeler::SightPtr happens to be a GS::SharedPtr<Sight>, which is not the same as a raw Sight* pointer.
Calling the code above will seem to work but in fact will produce memory corruption errors that are difficult to track.
Tibor's answer is better, although I have fixed my problem differently:
void* dummy = nullptr; ACAPI_3D_GetCurrentWindowSight(&dummy); Modeler::SightPtr currentSightPtr((Modeler::Sight*)dummy); // init the shared ptr with the raw pointer ModelerAPI::Model acModel; AttributeReader attrReader; EXPGetModel(currentSightPtr, &acModel, &attrReader);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-08-06 01:00 AM
drjustice wrote: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?
I would like to confirm that the code posted by paulk is indeed incorrect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-08-06 01:43 AM
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.
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.
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.
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.
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...