Choose your top Archicad wishes!

Read more
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

layoutinfo. customData give me bundles of guid - >value but where do I get a bundle of varname->guid

Anonymous
Not applicable
User was create new variable in master layout.
I need to get value of that variable by name.
But I have only pairs guid->value in the layout.customData.
How I can get values by variable name?
In original example Database_Control.cpp there is a no informative code how to change all variables:

//---->>>
API_LayoutInfo	layoutInfo;
BNZeroMemory (&layoutInfo, sizeof (API_LayoutInfo));
if (ACAPI_Environment (APIEnv_GetLayoutSetsID, &layoutInfo, &api_dbPars.databaseUnId) == NoError) 
{
	...
      for (auto it = layoutInfo.customData->EnumeratePairs (); it != nullptr; ++it) 
      {
                   *it->value += " - Modified via API";
       }
      ACAPI_Environment (APIEnv_ChangeLayoutSetsID, &layoutInfo, &api_dbPars.databaseUnId);
}
//<<<----
My code is:
//->>
API_LayoutInfo layoutInfo;
err = ACAPI_Environment(APIEnv_GetLayoutSetsID, &layoutInfo, &databaseUnId, &actualPageIndex);
if (layoutInfo.customData != nullptr)
{
       if (layoutInfo.customData->GetSize() > 0)
       {
             Guid keyguid;
             keyguid.ConvertFromString("7151E155-1B9B-4F17-9D4F-35F8036DE4A2");
             API_Guid key = GSGuid2APIGuid(keyguid);//layoutInfo.customData->GetAKey(0);
             UniString us;
	     if(layoutInfo.customData->ContainsKey(key))
                   us = layoutInfo.customData->Get(key);
	}
}

As result - us contains value.
But I need to get it by layout custom variable name;
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Oleg
Expert
I didnt try, but I guess you need function:

GSErrCode ACAPI_Database ( APIDb_GetLayoutBookID, API_LayoutBook* book );

and field

book->customScheme

View solution in original post

2 REPLIES 2
Solution
Oleg
Expert
I didnt try, but I guess you need function:

GSErrCode ACAPI_Database ( APIDb_GetLayoutBookID, API_LayoutBook* book );

and field

book->customScheme
Anonymous
Not applicable
It works great!
Thank you very much!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!