<?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 Inaccurate Bounding Box Coordinates for Door Labels with ARCHICAD API in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Inaccurate-Bounding-Box-Coordinates-for-Door-Labels-with/m-p/587590#M9157</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Hello Graphisoft Community,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm currently developing an ARCHICAD add-on and have come across an issue with calculating the bounding boxes for door labels. While I can obtain the bounding boxes successfully, upon checking the values, I've noticed that some coordinates do not accurately reflect the expected positions — they seem to be represented incorrectly. This issue is particularly puzzling because I can calculate the bounding boxes for zone stamps accurately using a similar method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Issue Summary: The bounding box data for door labels, specifically some of the coordinates, seem incorrect or not as expected. This contrasts with the results for zone stamps, where the bounding box calculations are accurate and consistent.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code Snippet:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;// Retrieve connected labels for the door
            GS::Array&amp;lt;API_Guid&amp;gt; connectedLabels;
            if (ACAPI_Grouping_GetConnectedElements(elementGuid, API_LabelID, &amp;amp;connectedLabels) == NoError) {
                for (const API_Guid&amp;amp; labelGuid : connectedLabels) {
                    // Retrieve label element data
                    API_Element labelElement;
                    BNZeroMemory(&amp;amp;labelElement, sizeof(API_Element));
                    labelElement.header.guid = labelGuid;

                    if (ACAPI_Element_Get(&amp;amp;labelElement) == NoError) {
                        // Get bounding box for the label
                        API_Box3D boundingBox;
                        if (ACAPI_Element_CalcBounds(&amp;amp;labelElement.header, &amp;amp;boundingBox) == NoError) {
                            
                                
                            // Capturing door label info within the existing label processing loop
                            DoorLabelInfo info = { APIGuidToString(labelGuid).ToCStr().Get(), boundingBox };
                            doorLabelInfos.push_back(info);

                            // Append label GUID and bounding box to the door report
                            sprintf(reportStr + strlen(reportStr), ", Label GUID: %s, Label Bounding Box: [(%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)]",
                                APIGuidToString(labelGuid).ToCStr().Get(),
                                boundingBox.xMin, boundingBox.yMin, boundingBox.zMin,
                                boundingBox.xMax, boundingBox.yMax, boundingBox.zMax);

                           

                        }
                        else {
                            // Handle error in retrieving the bounding box
                            sprintf(reportStr + strlen(reportStr), ", Label GUID: %s, Bounding Box: Not available",
                                APIGuidToString(labelGuid).ToCStr().Get());
                        }
                    }
                }
            }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Although I successfully obtained bounding boxes for door labels, when I checked the coordinates, some seemed to be represented wrongly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have attached a sample project file that I am working on, which illustrates the issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would greatly appreciate any advice, insights, or guidance on resolving this issue. Thank you in advance for your help!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-12-13 234120.png" style="width: 581px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/57310i700840C275E2C45F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-12-13 234120.png" alt="Screenshot 2023-12-13 234120.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 12:45:36 GMT</pubDate>
    <dc:creator>sercet65</dc:creator>
    <dc:date>2024-09-16T12:45:36Z</dc:date>
    <item>
      <title>Inaccurate Bounding Box Coordinates for Door Labels with ARCHICAD API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Inaccurate-Bounding-Box-Coordinates-for-Door-Labels-with/m-p/587590#M9157</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hello Graphisoft Community,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm currently developing an ARCHICAD add-on and have come across an issue with calculating the bounding boxes for door labels. While I can obtain the bounding boxes successfully, upon checking the values, I've noticed that some coordinates do not accurately reflect the expected positions — they seem to be represented incorrectly. This issue is particularly puzzling because I can calculate the bounding boxes for zone stamps accurately using a similar method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Issue Summary: The bounding box data for door labels, specifically some of the coordinates, seem incorrect or not as expected. This contrasts with the results for zone stamps, where the bounding box calculations are accurate and consistent.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code Snippet:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;// Retrieve connected labels for the door
            GS::Array&amp;lt;API_Guid&amp;gt; connectedLabels;
            if (ACAPI_Grouping_GetConnectedElements(elementGuid, API_LabelID, &amp;amp;connectedLabels) == NoError) {
                for (const API_Guid&amp;amp; labelGuid : connectedLabels) {
                    // Retrieve label element data
                    API_Element labelElement;
                    BNZeroMemory(&amp;amp;labelElement, sizeof(API_Element));
                    labelElement.header.guid = labelGuid;

                    if (ACAPI_Element_Get(&amp;amp;labelElement) == NoError) {
                        // Get bounding box for the label
                        API_Box3D boundingBox;
                        if (ACAPI_Element_CalcBounds(&amp;amp;labelElement.header, &amp;amp;boundingBox) == NoError) {
                            
                                
                            // Capturing door label info within the existing label processing loop
                            DoorLabelInfo info = { APIGuidToString(labelGuid).ToCStr().Get(), boundingBox };
                            doorLabelInfos.push_back(info);

                            // Append label GUID and bounding box to the door report
                            sprintf(reportStr + strlen(reportStr), ", Label GUID: %s, Label Bounding Box: [(%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)]",
                                APIGuidToString(labelGuid).ToCStr().Get(),
                                boundingBox.xMin, boundingBox.yMin, boundingBox.zMin,
                                boundingBox.xMax, boundingBox.yMax, boundingBox.zMax);

                           

                        }
                        else {
                            // Handle error in retrieving the bounding box
                            sprintf(reportStr + strlen(reportStr), ", Label GUID: %s, Bounding Box: Not available",
                                APIGuidToString(labelGuid).ToCStr().Get());
                        }
                    }
                }
            }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Although I successfully obtained bounding boxes for door labels, when I checked the coordinates, some seemed to be represented wrongly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have attached a sample project file that I am working on, which illustrates the issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would greatly appreciate any advice, insights, or guidance on resolving this issue. Thank you in advance for your help!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-12-13 234120.png" style="width: 581px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/57310i700840C275E2C45F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-12-13 234120.png" alt="Screenshot 2023-12-13 234120.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:45:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Inaccurate-Bounding-Box-Coordinates-for-Door-Labels-with/m-p/587590#M9157</guid>
      <dc:creator>sercet65</dc:creator>
      <dc:date>2024-09-16T12:45:36Z</dc:date>
    </item>
  </channel>
</rss>

