<?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 APIElementEventHandlerProc bug? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247651#M5451</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;I am doing an add-on where I will get the area of the zone when it was modified. I used the element event handler and handled the following events:&lt;BR /&gt;
&lt;PRE&gt;APINotifyElement_Change
APINotifyElement_Edit
APINotifyElement_Undo_Modified
APINotifyElement_Redo_Modified&lt;/PRE&gt;
I am also using the quantities to get the area (&lt;FONT color="gray"&gt;ACAPI_Element_GetQuantities()&lt;/FONT&gt;).&lt;BR /&gt;&lt;BR /&gt;But the value of the area when &lt;FONT color="gray"&gt;APINotifyElement_Undo_Modified&lt;/FONT&gt; was called, the value of the saved area is the same as those that are in quantities.&lt;BR /&gt;&lt;BR /&gt;EXAMPLE:
&lt;PRE&gt;ORIGINAL_AREA = 100&lt;/PRE&gt;
&lt;FONT color="gray"&gt;APINotifyElement_Edit&lt;/FONT&gt; is called:
&lt;PRE&gt;ORIGINAL_AREA = 100
QUANTITY_AREA = 150 (let say that this is the "new" area)&lt;/PRE&gt;
I save the new value:
&lt;PRE&gt;ORIGINAL_AREA = 150&lt;/PRE&gt;
&lt;FONT color="gray"&gt;APINotifyElement_Undo_Modified&lt;/FONT&gt; is called:
&lt;PRE&gt;ORIGINAL_AREA = 150
QUANTITY_AREA = 150&lt;/PRE&gt;
Since it is &lt;STRONG&gt;undo&lt;/STRONG&gt;, I am expecting that quantity value should be 100.&lt;BR /&gt;&lt;BR /&gt;Is this a bug or should the undo value is located on different structure?&lt;/DIV&gt;</description>
    <pubDate>Tue, 01 Aug 2023 11:37:48 GMT</pubDate>
    <dc:creator>ReignBough</dc:creator>
    <dc:date>2023-08-01T11:37:48Z</dc:date>
    <item>
      <title>APIElementEventHandlerProc bug?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247651#M5451</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I am doing an add-on where I will get the area of the zone when it was modified. I used the element event handler and handled the following events:&lt;BR /&gt;
&lt;PRE&gt;APINotifyElement_Change
APINotifyElement_Edit
APINotifyElement_Undo_Modified
APINotifyElement_Redo_Modified&lt;/PRE&gt;
I am also using the quantities to get the area (&lt;FONT color="gray"&gt;ACAPI_Element_GetQuantities()&lt;/FONT&gt;).&lt;BR /&gt;&lt;BR /&gt;But the value of the area when &lt;FONT color="gray"&gt;APINotifyElement_Undo_Modified&lt;/FONT&gt; was called, the value of the saved area is the same as those that are in quantities.&lt;BR /&gt;&lt;BR /&gt;EXAMPLE:
&lt;PRE&gt;ORIGINAL_AREA = 100&lt;/PRE&gt;
&lt;FONT color="gray"&gt;APINotifyElement_Edit&lt;/FONT&gt; is called:
&lt;PRE&gt;ORIGINAL_AREA = 100
QUANTITY_AREA = 150 (let say that this is the "new" area)&lt;/PRE&gt;
I save the new value:
&lt;PRE&gt;ORIGINAL_AREA = 150&lt;/PRE&gt;
&lt;FONT color="gray"&gt;APINotifyElement_Undo_Modified&lt;/FONT&gt; is called:
&lt;PRE&gt;ORIGINAL_AREA = 150
QUANTITY_AREA = 150&lt;/PRE&gt;
Since it is &lt;STRONG&gt;undo&lt;/STRONG&gt;, I am expecting that quantity value should be 100.&lt;BR /&gt;&lt;BR /&gt;Is this a bug or should the undo value is located on different structure?&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 11:37:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247651#M5451</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2023-08-01T11:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: APIElementEventHandlerProc bug?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247652#M5452</link>
      <description>I found a &amp;lt;del&amp;gt;&lt;B&gt;hack&lt;/B&gt;&amp;lt;/del&amp;gt; &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;temporary solution&lt;E&gt;&lt;/E&gt; to this problem.&lt;BR /&gt;
&lt;BR /&gt;
I created a global variable where i save the value of &lt;FONT color="gray"&gt;API_NotifyElementType&lt;/FONT&gt;. I will then process it on &lt;FONT color="gray"&gt;APINotifyElement_EndEvents&lt;/FONT&gt;.&lt;BR /&gt;

&lt;PRE&gt;GSErrCode __ACENV_CALL MyElemObserver(const API_NotifyElementType* iElemType)
{
	switch (iElemType-&amp;gt;notifID)
	{
	// ...other notify ids...
	case APINotifyElement_EndEvents:
		switch (g_LastEvent.notifID)
		{
		case APINotifyElement_Undo_Modified:	//&amp;lt;== handle here
		case APINotifyElement_Redo_Modified:	//&amp;lt;== handle here
			Foo(g_LastEvent.elemHead.guid);
			break;
		}
		break;
	}
	g_LastEvent = *iElemType;	//&amp;lt;== save here
	return NoError;
};&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Feb 2015 03:00:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247652#M5452</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2015-02-23T03:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: APIElementEventHandlerProc bug?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247653#M5453</link>
      <description>&lt;BLOCKQUOTE&gt;ReignBough wrote:&lt;BR /&gt;I found a &lt;B&gt;hack&lt;/B&gt; to this problem.&lt;BR /&gt;
I created a global variable where i save the value of &lt;FONT color="gray"&gt;API_NotifyElementType&lt;/FONT&gt;. I will then process it on &lt;FONT color="gray"&gt;APINotifyElement_EndEvents&lt;/FONT&gt;.
&lt;/BLOCKQUOTE&gt;
That's not a hack. The begin/end structure of the notification process allows you to cache all the elements involved in a transaction and batch process them at the end.</description>
      <pubDate>Thu, 05 Mar 2015 09:27:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/APIElementEventHandlerProc-bug/m-p/247653#M5453</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2015-03-05T09:27:30Z</dc:date>
    </item>
  </channel>
</rss>

