Choose your top Archicad wishes!

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

Change the default value of a parameter in a LibPart


Hello experts,
I am a newbie and am here trying to get some information about changing the default value of a parameter in a LibPart. By reading this topic, I have managed to call APIAny_OpenParametersID, APIAny_GetActParametersID, and APIAny_ChangeAParameterID on the parameter with NoError. But the parameter value does not change. Do I need to call some extra function after APIAny_ChangeAParameterID in order to "overwrite" the library part with the new default parameter value?

Ralph Wessel

Is the library part stored in a writable state? If not, e.g. embedded in an LCF, you won't be able to write changes to it

Ralph Wessel BArch

I'm not sure if it's in a writable state. The library part is in the embedded library folder. Do I need to call  ACAPI_Environment(APIEnv_OverwriteLibPartID) or some function to make it writable?

If it's in the embedded library, you should be able to echo the example code for ACAPI_LibraryPart_OpenParameters here:

Ralph Wessel BArch


Thank you for pointing me to an example.
Below is what I'm actually doing in my add-on to change the value of the "c4dPhoIESFile" parameter of a library part (lamp):

BNZeroMemory(&libPart, sizeof(API_LibPart));
// I have both parentUniID and ownUniID values of the library part in std::string variables
strcpy(libPart.ownUnID, ownUniID.c_str());
strcpy(libPart.parentUnID, parentUniID.c_str());
auto err = ACAPI_LibPart_Search(&libPart, false);
if (err != NoError)
    ACAPI_WriteReport(L("Failed to search the library part"), true);

API_GetParamsType theParams{ };
API_ParamOwnerType paramOwner{ };
paramOwner.typeID = API_ObjectID; // may have to be API_LampID?
paramOwner.libInd = libPart.index;
GSErrCode err = ACAPI_Goodies(APIAny_OpenParametersID, &paramOwner);
err |= ACAPI_Goodies(APIAny_GetActParametersID, &theParams);
if (err == NoError) {
    API_ChangeParamType changeParam{ };
    CHTruncate("c4dPhoIESFile",, API_NameLen);
    GS::UniString uniStrName("test.ies");
    GS::uchar_t uniStrBuffer[_MAX_FNAME]{ 0 };
    GS::ucsncpy(uniStrBuffer, uniStrName.ToUStr().Get(), _MAX_FNAME);
    changeParam.uStrValue = uniStrBuffer;
    err = ACAPI_Goodies(APIAny_ChangeAParameterID, &changeParam);
    if (err != NoError)
        ACAPI_WriteReport(L("[LampImportTest, ERROR] Failed to update the c4dPhoIESFile parameter"), true);
else ACAPI_WriteReport(L("[LampImportTest, ERROR] Failed to get the c4dPhoIESFile parameter"), true);

This runs without any errors but the parameter value doesn't change.

I checked the parameter on GDL Object Editor, and noticed that its type is not a simple string but a list of selectable strings (which is called a "value list" in ARCHICAD terminology?)




"test.ies" is certainly in the list, but it doesn't seem to be able to select it by simply setting a value to the parameter. Can you suggest me how to deal with this type of parameter using the API?