<?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 active view in ArchiCAD API? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/572563#M8780</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's no function to get the active view directly as far as I know.&lt;/P&gt;
&lt;P&gt;But you can workaround this with using with a &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___notification.html#ga08f6e48360bf20d85dacee0d5102f0d3" target="_blank"&gt;View Notification Handler&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to register the notification handler in the &lt;STRONG&gt;Initialize&lt;/STRONG&gt; function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;ACAPI_Notify_CatchViewEvent (APINotifyView_Opened, API_MyViewMap, ViewNoticationHandlerProc);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has to be done separately for every &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___notification.html#ga34db1cfa084cd90d24e4268e43e176fe" target="_blank"&gt;API_NavigatorMapID&lt;/A&gt; you need. So you'll have to use a bit of trial and error to figure out which ones you'll need.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;And the handler would look something like this:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;static GSErrCode __ACENV_CALL ViewNoticationHandlerProc (const API_NotifyViewEventType* viewEvent)
{
	switch (viewEvent-&amp;gt;notifID) {
	case APINotifyView_Opened: {
		// Do something here with `viewEvent-&amp;gt;itemGuid`
		break;
	}
	default: break;
	}

	return NoError;
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the Add-On needs to be registered as a preloaded Add-On. So return &lt;STRONG&gt;API_Addon_Preload&lt;/STRONG&gt; in &lt;STRONG&gt;CheckEnvironment&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2023 21:14:50 GMT</pubDate>
    <dc:creator>BerndSchwarzenbacher</dc:creator>
    <dc:date>2023-10-24T21:14:50Z</dc:date>
    <item>
      <title>How to get active view in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/571956#M8770</link>
      <description>&lt;P&gt;hi guys,&lt;/P&gt;
&lt;P&gt;Do you know how to get active view?&lt;/P&gt;
&lt;P&gt;(I think I need to use&amp;nbsp;API_NavigatorItem, But I couldn't do it)&lt;/P&gt;
&lt;P&gt;If you know, please help me&lt;/P&gt;
&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:38:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/571956#M8770</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2024-09-16T12:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get active view in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/572563#M8780</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's no function to get the active view directly as far as I know.&lt;/P&gt;
&lt;P&gt;But you can workaround this with using with a &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___notification.html#ga08f6e48360bf20d85dacee0d5102f0d3" target="_blank"&gt;View Notification Handler&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to register the notification handler in the &lt;STRONG&gt;Initialize&lt;/STRONG&gt; function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;ACAPI_Notify_CatchViewEvent (APINotifyView_Opened, API_MyViewMap, ViewNoticationHandlerProc);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has to be done separately for every &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___notification.html#ga34db1cfa084cd90d24e4268e43e176fe" target="_blank"&gt;API_NavigatorMapID&lt;/A&gt; you need. So you'll have to use a bit of trial and error to figure out which ones you'll need.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;And the handler would look something like this:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;static GSErrCode __ACENV_CALL ViewNoticationHandlerProc (const API_NotifyViewEventType* viewEvent)
{
	switch (viewEvent-&amp;gt;notifID) {
	case APINotifyView_Opened: {
		// Do something here with `viewEvent-&amp;gt;itemGuid`
		break;
	}
	default: break;
	}

	return NoError;
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the Add-On needs to be registered as a preloaded Add-On. So return &lt;STRONG&gt;API_Addon_Preload&lt;/STRONG&gt; in &lt;STRONG&gt;CheckEnvironment&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps!&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 21:14:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/572563#M8780</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-24T21:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get active view in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/573124#M8806</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I followed your tutorials, but it still doesn't work? Can you check and tell me where I'm wrong&lt;/P&gt;
&lt;P&gt;This is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;API_AddonType __ACENV_CALL CheckEnvironment(API_EnvirParams* envir)
{
RSGetIndString(&amp;amp;envir-&amp;gt;addOnInfo.name, ID_ADDON_INFO, 1, ACAPI_GetOwnResModule());

RSGetIndString(&amp;amp;envir-&amp;gt;addOnInfo.description, ID_ADDON_INFO, 2, ACAPI_GetOwnResModule());

return APIAddon_Preload;
}



static GSErrCode __ACENV_CALL ViewNoticationHandlerProc(const API_NotifyViewEventType* viewEvent)
{

switch (viewEvent-&amp;gt;notifID) {
case APINotifyView_Opened: {

// Do something here with `viewEvent-&amp;gt;itemGuid`
WriteReport_Alert("View");
break;
}
default: break;
}

return NoError;
}


GSErrCode __ACENV_CALL Initialize(void)
{
GSErrCode err = ACAPI_Install_MenuHandler(ID_MENU_STRINGS, MenuCommandHandler);

API_NavigatorMapID mapId = API_MyViewMap;

ACAPI_Notify_CatchViewEvent(APINotifyView_Opened, mapId, ViewNoticationHandlerProc);

if (err != NoError)
DBPrintf("3D_Test:: Initialize () ACAPI_Install_MenuHandler failed\n");


return err;
} // Initialize&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="received_3152864891523556.png" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/48130iE1BFD785A015C0DC/image-size/large?v=v2&amp;amp;px=999" role="button" title="received_3152864891523556.png" alt="received_3152864891523556.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 02:52:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/573124#M8806</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2023-10-30T02:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get active view in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/573387#M8808</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;&amp;nbsp;, Can you help me?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 09:35:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/573387#M8808</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2023-10-31T09:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get active view in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/573391#M8809</link>
      <description>&lt;P&gt;I'm quite busy right now, but tomorrow I'll have more time to take a closer look.&lt;BR /&gt;&lt;BR /&gt;Please specify what exactly is not working.&lt;BR /&gt;What did you try to do in the program and what did you expect to happen?&lt;BR /&gt;&lt;BR /&gt;From a quick look at the code it seems OK. Maybe try different NavigatorMapIDs like &lt;STRONG&gt;API_ProjectMap, API_UndefinedMap, API_PublicViewMap.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 09:40:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/573391#M8809</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-31T09:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get active view in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/574032#M8823</link>
      <description>&lt;P&gt;I did a few quick tests by opening different view maps in Archicad and checking which map ID is used in the triggered view notification.&lt;BR /&gt;Here's the mapping of Archicad Navigator Map -&amp;gt; &lt;STRONG&gt;API_NavigatorMapIDs&lt;/STRONG&gt; when listening to &lt;STRONG&gt;APINotifyView_Opened&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Project Map (Stories, Elevations, Schedules, ...) -&amp;gt; &lt;STRONG&gt;API_ProjectMap&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt; API_PublicViewMap&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Layout Book &amp;amp; Publisher Sets -&amp;gt; &lt;STRONG&gt;API_UndefinedMap&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Couldn't find anything that triggered the &lt;STRONG&gt;API_MyViewMap&lt;/STRONG&gt;. I'm sure I used it before for something, but can't remember now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps,&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2023 08:58:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-get-active-view-in-ArchiCAD-API/m-p/574032#M8823</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-11-04T08:58:28Z</dc:date>
    </item>
  </channel>
</rss>

