We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

ACAPI_GetPreferences how to get its data?

Newbie
Participant

I am stuck on getting return data of the above function with below sample code;

 

Int32 version;
GSSize nBytes;
GSPtr pref;
ACAPI_GetPreferences (&version, &nBytes, nullptr);
if (version == MY_PREFERENCES_VERSION) {
pref = BMAllocatePtr (nBytes, ALLOCATE_CLEAR, 0);
if (pref != nullptr) {
ACAPI_GetPreferences (&version, &nBytes, pref);
// do something with the preferences data
BMKillPtr (&pref); // dispose allocated pointer
}
};

 

Is there anyone know how to convert "pref" to readable text?

 

3 REPLIES 3
Joel Buehler
Enthusiast

Short Question: Did you fill in your Data before? That function is for storing your own data, with your own datastructure:

 

JoelBuehler_0-1689453014702.png

 

Hello Joel,

I already set the preference data according to its suggestion doc but still can't retrieve it back since the last parameter of get API is GSPtr which do not know how to convert it readable character. Do you have any idea?

 

Thanks.

 

 

kovacsv
Booster

Here you can find a detailed explanation of preferences handling:

https://archicadapi.graphisoft.com/archicad-maze-generator-add-on-tutorial-part-3