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.

Reading non default param values from GDL object

Not applicable
Hey everyone,

i need to read some variable from a GDL object from the API. The variable is not exposed to a parameter since it is used only internally. To expose the variable to the API i created a new parameter in GDL that gets its value from the internal variable. (Alternatively i tried just creating a parameter with the same name as the variable) However with the memo from ACAPI_Element_GetMemo is just get the default value(s) and never the actual one of the placed object.

Can anyone tell me what im doing wrong? Thanks in advance!

    // loop all object guids for counting
    int bike_count = 0;
    int car_count = 0;
    for (UIndex i = 0; i < objguids.GetSize (); ++i) {
        GS::Guid gsguid = APIGuid2GSGuid (objguids);
        API_Element element = {};
        element.header.guid = objguids;
        err = ACAPI_Element_Get (&element);
        Int32 lib_idx = element.object.libInd;
        API_LibPart libPart;
        BNZeroMemory (&libPart, sizeof (API_LibPart));
        libPart.index = lib_idx;
        err = ACAPI_LibPart_Get (&libPart);
        if (!err) {
            GS::UniString part_name = libPart.docu_UName;
            if (part_name=="Fahrrad Symbol 22"){
                bike_count += 1;
            }else if(part_name=="Parkplätze Linienzug 22_b"){
                API_ElementMemo  memo;
                if (err == NoError && element.header.hasMemo) {
                    err = ACAPI_Element_GetMemo (element.header.guid, &memo, APIMemoMask_AddPars);
                    if (err == NoError) {
                        UInt32 totalParams = BMGetHandleSize((GSConstHandle)memo.params) / sizeof(API_AddParType);  // number of parameters = handlesize / size of single handle
                        for (int i=0; i<totalParams ;i++){
                            if ((*memo.params).name == (GS::UniString) "places"){
                                int places = (*memo.params).value.real;
                                car_count = car_count+places;
                                WriteReport("param name: %s", (*memo.params).name);

                    ACAPI_DisposeElemMemoHdls (&memo);


Accepted Solutions
Not applicable
Ok it was a GDL issue in the end. Thanks for reading anyways!

View solution in original post

Not applicable
Ok it was a GDL issue in the end. Thanks for reading anyways!
Learn and get certified!