<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reading non default param values from GDL object in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Reading-non-default-param-values-from-GDL-object/m-p/229573#M3754</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hey everyone,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Can anyone tell me what im doing wrong? Thanks in advance!&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;    // loop all object guids for counting
    int bike_count = 0;
    int car_count = 0;
    for (UIndex i = 0; i &amp;lt; objguids.GetSize (); ++i) {
        GS::Guid gsguid = APIGuid2GSGuid (objguids&lt;I&gt;);
        API_Element element = {};
        element.header.guid = objguids&lt;I&gt;;
        err = ACAPI_Element_Get (&amp;amp;element);
        Int32 lib_idx = element.object.libInd;
        
        API_LibPart libPart;
        BNZeroMemory (&amp;amp;libPart, sizeof (API_LibPart));
        libPart.index = lib_idx;
        err = ACAPI_LibPart_Get (&amp;amp;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 &amp;amp;&amp;amp; element.header.hasMemo) {
                    err = ACAPI_Element_GetMemo (element.header.guid, &amp;amp;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&amp;lt;totalParams ;i++){
                            if ((*memo.params)&lt;I&gt;.name == (GS::UniString) "places"){
                                int places = (*memo.params)&lt;I&gt;.value.real;
                                car_count = car_count+places;
                            }else{
                                WriteReport("param name: %s", (*memo.params)&lt;I&gt;.name);
                            }

                        }
                    }
                    ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
                }
            }
        }
    }

&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 09 Sep 2024 09:06:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-09T09:06:05Z</dc:date>
    <item>
      <title>Reading non default param values from GDL object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Reading-non-default-param-values-from-GDL-object/m-p/229573#M3754</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hey everyone,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Can anyone tell me what im doing wrong? Thanks in advance!&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;    // loop all object guids for counting
    int bike_count = 0;
    int car_count = 0;
    for (UIndex i = 0; i &amp;lt; objguids.GetSize (); ++i) {
        GS::Guid gsguid = APIGuid2GSGuid (objguids&lt;I&gt;);
        API_Element element = {};
        element.header.guid = objguids&lt;I&gt;;
        err = ACAPI_Element_Get (&amp;amp;element);
        Int32 lib_idx = element.object.libInd;
        
        API_LibPart libPart;
        BNZeroMemory (&amp;amp;libPart, sizeof (API_LibPart));
        libPart.index = lib_idx;
        err = ACAPI_LibPart_Get (&amp;amp;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 &amp;amp;&amp;amp; element.header.hasMemo) {
                    err = ACAPI_Element_GetMemo (element.header.guid, &amp;amp;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&amp;lt;totalParams ;i++){
                            if ((*memo.params)&lt;I&gt;.name == (GS::UniString) "places"){
                                int places = (*memo.params)&lt;I&gt;.value.real;
                                car_count = car_count+places;
                            }else{
                                WriteReport("param name: %s", (*memo.params)&lt;I&gt;.name);
                            }

                        }
                    }
                    ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
                }
            }
        }
    }

&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Sep 2024 09:06:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Reading-non-default-param-values-from-GDL-object/m-p/229573#M3754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-09T09:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading non default param values from GDL object</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Reading-non-default-param-values-from-GDL-object/m-p/229574#M3755</link>
      <description>Ok it was a GDL issue in the end. Thanks for reading anyways!</description>
      <pubDate>Mon, 03 Jun 2019 15:50:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Reading-non-default-param-values-from-GDL-object/m-p/229574#M3755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-03T15:50:46Z</dc:date>
    </item>
  </channel>
</rss>

