BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

Retrieving Detailed Information for Dimension Elements in Archicad API

sercet65
Booster

Hello fellow developers,

 

I'm currently working on an Archicad Add-On where I need to extract detailed information about dimension elements. My current implementation allows me to retrieve basic information such as the GUID, line pen, and text position of dimension elements. Here is a snippet of my code for context:

 

void ReportDimensionElementProperties(const API_Guid& elementGuid, API_ElemTypeID elemType, std::ofstream& outFile) {
    char reportStr[1024];
    API_Element element;
    BNZeroMemory(&element, sizeof(API_Element));
    element.header.guid = elementGuid;

    GSErrCode err = ACAPI_Element_Get(&element);
    if (err == NoError && elemType == API_DimensionID) {
        API_DimensionType& dimension = element.dimension;

        // Format the report string with extracted properties from linear dimension
        sprintf(reportStr, "Linear Dimension, GUID: %s, Line Pen: %d, Text Position: %d",
            APIGuidToString(elementGuid).ToCStr().Get(),
            dimension.linPen,
            dimension.textPos);

        outFile << reportStr << std::endl;
    }
    else {
        // Handle error in retrieving the element or unsupported element type
    }
}

 

However, I would like to delve deeper and retrieve more information such as:

  1. The annotation text of each dimension.
  2. The unique IDs of these annotation texts.
  3. Information about which building elements (like walls, slabs, etc.) these dimensions are attached to, if applicable.

I've explored the Archicad API documentation but haven't found a clear path to achieve this. Does anyone have experience or suggestions on how to extract these additional details for dimension elements? Any insights or guidance would be greatly appreciated, especially code snippets or references to specific API functions that could be useful.

 

Thank you in advance!

 

sercet65_0-1703114348040.png

 

 

0 REPLIES 0
Learn and get certified!