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.

How to Obtain Bounding Box of Dimension Text in Archicad API


I am currently working on a project using the Archicad API and I've encountered a challenge regarding dimension elements. Specifically, I am looking to obtain the bounding box for individual dimension texts.

So far, I have been successful in extracting various properties of dimension elements, such as the GUID, associated element GUID, text content, length, and position. However, I am unable to find a way to determine the bounding box for each dimension text.


Here is a snippet of my current approach:

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_ElementMemo memo;
        BNZeroMemory(&memo, sizeof(API_ElementMemo));
        double totalLength = 0.0; // Variable to accumulate total length
        if (ACAPI_Element_GetMemo(element.header.guid, &memo) == NoError) {
            Int32 numDimElems = BMGetHandleSize((GSHandle)memo.dimElems) / sizeof(API_DimElem);
            for (Int32 i = 0; i < numDimElems; ++i) {
                API_DimElem& dimElem = (*memo.dimElems)[i];
                API_Base base = reinterpret_cast<API_Base&>(dimElem.base);
                totalLength += dimElem.dimVal; // Accumulate the length
                // Extracting Dimension Text
                GS::UniString dimText = (dimElem.note.contentUStr != nullptr) ?
                    *(dimElem.note.contentUStr) :

                // Formatting the output string for each dimension element
                sprintf(reportStr, "Dimension element [%d], GUID: %s, Associated Element GUID: %s, Text: %s, Length: %.2f mm, Position: (%.2f, %.2f)",
                    dimElem.pos.x, dimElem.pos.y);

                outFile << reportStr << std::endl;

            // Retrieve and report the bounding box for the entire dimension element
            API_Box3D boundingBox;
            if (ACAPI_Element_CalcBounds(&element.header, &boundingBox) == NoError) {
                sprintf(reportStr, "Linear Dimension Element, GUID: %s, Bounding Box: [(%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)], Total Length : % .2f mm",
                    boundingBox.xMin, boundingBox.yMin, boundingBox.zMin,
                    boundingBox.xMax, boundingBox.yMax, boundingBox.zMax,
                    totalLength); // Include total length here
            else {
                // Handle error in retrieving the bounding box
                sprintf(reportStr, "Bounding Box for Dimension Element, GUID: %s: Not available",

            outFile << reportStr << std::endl;
        else {
            strcat(reportStr, "Error retrieving element memo");
            outFile << reportStr << std::endl;
    else {
        strcat(reportStr, "Error or Unsupported Element Type");
        outFile << reportStr << std::endl;

My question is: Is there a method or property in the Archicad API that allows access to the bounding box of individual dimension texts? If so, could you provide some guidance or examples on how to implement this?

Any insights or suggestions on this matter would be greatly appreciated.


Thank you in advance for your assistance.

Learn and get certified!