cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

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

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!

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!