SOLVED!
Reading non default param values from GDL object
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-06-03
02:53 PM
- last edited on
2024-09-09
11:06 AM
by
Doreena Deng
2019-06-03
02:53 PM
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!
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); } } } }
Solved! Go to Solution.
Labels:
- Labels:
-
Discussion
1 ACCEPTED SOLUTION
Accepted Solutions
Solution
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-06-03 05:50 PM
2019-06-03
05:50 PM
Ok it was a GDL issue in the end. Thanks for reading anyways!
1 REPLY 1
Solution
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-06-03 05:50 PM
2019-06-03
05:50 PM
Ok it was a GDL issue in the end. Thanks for reading anyways!