<?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: Missing doors from ACAPI_Element_GetRelations() when placed in middle of room/zone in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/376220#M1305</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;SPAN&gt;mszaraz - I have been busy attending other tasks for a while, so I was only recently able to get back to this one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the code snippet gave me very valuable insight into how I might potentially improve our current code, it did unfortunately not work with my example model.&lt;/P&gt;&lt;P&gt;In accordance with your suggestion, I am doing this in my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ACAPI_Element_GetRelations(zoneGuid, API_ZombieElemID, &amp;amp;roomRelation);&lt;/P&gt;&lt;P&gt;if( roomRelation.elementsGroupedByType.ContainsKey(API_DoorID))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I never get into the if-block for the zone where the door is place in the middle. However for the zone where the door is attached to the bounding wall, the if-block does get activated.&lt;/P&gt;&lt;P&gt;Could there be some other conditions for getting this right in the model? I noticed that the model in your example contains a bounding wall on the zone, whereas my model has a “raw” zone for that part of the model.&lt;/P&gt;&lt;P&gt;Here is a screenshot of my model:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bitwreckage_0-1681193976189.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/36025iABC2FB58972D1084/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bitwreckage_0-1681193976189.png" alt="Bitwreckage_0-1681193976189.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any further suggestions are much welcome.&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2023 06:23:17 GMT</pubDate>
    <dc:creator>Bitwreckage</dc:creator>
    <dc:date>2023-04-11T06:23:17Z</dc:date>
    <item>
      <title>Missing doors from ACAPI_Element_GetRelations() when placed in middle of room/zone</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/365718#M1303</link>
      <description>&lt;P&gt;I have been investigating an issue where our Archicad plugin did not seem able to fetch doors, which were placed in the middle of a room/zone.&lt;/P&gt;&lt;P&gt;Eventually I found that our code uses in essence&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;ACAPI_Element_GetRelations( roomGuid, API_DoorID, &amp;amp;relData )&lt;/FONT&gt; to get all doors belonging to a room/zone, but that this method would never give us a result with a door residing in the middle of a zone.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I started out testing this method with &lt;FONT face="courier new,courier"&gt;API_DoorID&lt;/FONT&gt; as the "&lt;FONT face="courier new,courier"&gt;otherType&lt;/FONT&gt;" parameter, but soon tried out the whole range of types from &lt;FONT face="courier new,courier"&gt;API_ZombieElemID&lt;/FONT&gt; up to and including&amp;nbsp;&lt;FONT face="courier new,courier"&gt;API_OpeningID&lt;/FONT&gt; plus&amp;nbsp;&lt;FONT face="courier new,courier"&gt;API_ExternalElemID&lt;/FONT&gt;, but to no avail. No in-the-middle-of-room doors for me!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My current "hack solution" is to use&amp;nbsp;&lt;FONT face="courier new,courier"&gt;ACAPI_Element_GetElemList()&lt;/FONT&gt; with the element type id &lt;FONT face="courier new,courier"&gt;API_DoorID&lt;/FONT&gt;, and then filtering the result on &lt;FONT face="courier new,courier"&gt;fromRoom&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;toRoom&lt;/FONT&gt; of the received doors being the room of interest.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am concerned though about the efficiency of this approach - thinking of how this would work in big models, where the user could be dealing with several thousand instances of doors.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can anybody recommend an efficient way of retrieving all doors belonging to a room (including doors residing in the middle of the room)?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 21:09:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/365718#M1303</guid>
      <dc:creator>Bitwreckage</dc:creator>
      <dc:date>2022-12-21T21:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Missing doors from ACAPI_Element_GetRelations() when placed in middle of room/zone</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/368557#M1304</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think some parameter or its combination is wrong. The following code snippet works for me (if the doors are connected to the Zone/Room). The code snippet is based on the Element_Test example addon's source (Do_DumpZone method).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;API_Element			element = {};

if (!ClickAnElem ("Click a zone", API_ZoneID, nullptr, &amp;amp;element.header.type, &amp;amp;element.header.guid)) {
	WriteReport_Alert ("No zone was clicked");
	return;
}

WriteReport ("Doors connected to the selected room:");
API_RoomRelation	roomInfo;
GSErrCode err = ACAPI_Element_GetRelations (element.header.guid, API_ZombieElemID, &amp;amp;roomInfo);
if (err == NoError &amp;amp;&amp;amp; roomInfo.elementsGroupedByType.ContainsKey (API_DoorID)) {
	for (const auto&amp;amp; id : roomInfo.elementsGroupedByType[API_DoorID]) {
		WriteReport ("%s", APIGuidToString (id).ToCStr ().Get ());
	}
}&lt;/LI-CODE&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;Doors connected to the selected room:
05958BF9-E5F0-3046-8BDD-12C0EE5E501B
7C23555D-563A-D940-838C-4B85C1DE4CFE&lt;/LI-CODE&gt;&lt;P&gt;For this zone/room:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-01-23 at 14.18.15.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/33750i9802BE31801F84C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-01-23 at 14.18.15.png" alt="Screenshot 2023-01-23 at 14.18.15.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 13:20:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/368557#M1304</guid>
      <dc:creator>mszaraz</dc:creator>
      <dc:date>2023-01-23T13:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Missing doors from ACAPI_Element_GetRelations() when placed in middle of room/zone</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/376220#M1305</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;SPAN&gt;mszaraz - I have been busy attending other tasks for a while, so I was only recently able to get back to this one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the code snippet gave me very valuable insight into how I might potentially improve our current code, it did unfortunately not work with my example model.&lt;/P&gt;&lt;P&gt;In accordance with your suggestion, I am doing this in my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ACAPI_Element_GetRelations(zoneGuid, API_ZombieElemID, &amp;amp;roomRelation);&lt;/P&gt;&lt;P&gt;if( roomRelation.elementsGroupedByType.ContainsKey(API_DoorID))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I never get into the if-block for the zone where the door is place in the middle. However for the zone where the door is attached to the bounding wall, the if-block does get activated.&lt;/P&gt;&lt;P&gt;Could there be some other conditions for getting this right in the model? I noticed that the model in your example contains a bounding wall on the zone, whereas my model has a “raw” zone for that part of the model.&lt;/P&gt;&lt;P&gt;Here is a screenshot of my model:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bitwreckage_0-1681193976189.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/36025iABC2FB58972D1084/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bitwreckage_0-1681193976189.png" alt="Bitwreckage_0-1681193976189.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any further suggestions are much welcome.&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 06:23:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Missing-doors-from-ACAPI-Element-GetRelations-when-placed-in/m-p/376220#M1305</guid>
      <dc:creator>Bitwreckage</dc:creator>
      <dc:date>2023-04-11T06:23:17Z</dc:date>
    </item>
  </channel>
</rss>

