License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Reading non default param values from GDL object

Anonymous
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;
                            }else{
                                WriteReport("param name: %s", (*memo.params).name);
                            }

                        }
                    }
                    ACAPI_DisposeElemMemoHdls (&memo);
                }
            }
        }
    }

1 ACCEPTED SOLUTION

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

View solution in original post

1 REPLY 1
Solution
Anonymous
Not applicable
Ok it was a GDL issue in the end. Thanks for reading anyways!