APIAny_​GetPropertyAutoTextKeyTableID

Retrieves the context dependent autotexts keys.

    GSErrCode ACAPI_Goodies (
        APIAny_GetPropertyAutoTextKeyTableID,
        API_GUID*                                       guid,
        GS::HashTable<GS::UniString,GS::UniString>      keyGuidTable
    );

 

Parameters

guID
[in] A pointer to a API_Guid that represents an object like a wall or slab. It can be APINULLGuid, but then only the general autotexts can be received like “Area”, “Element ID” (which are common in all element types), and not the element specific ones like “Thickness of the wall”.
keyGuidTable
[out] Pointer to a hash table where the resulting autotext names and keys will be stored for a given guid.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
The passed parameters are invalid.

For other common API errors see the API Errors document.

 

Remarks

This function will fill the passed hast table with the autotexts’ name and key for any given an element like a wall. The names are the same as they can be seen in ARCHICAD while inserting an autotext into a text field, for example “Area”.

The function allows for an APINULLGuid input. But keep in mind that in this case only the general autotexts will be returned.

The resulting autotext keys can be used to create autotexts or to access the value of certain parameters associated with an object using the function APIAny_InterpretAutoTextID. These property keys usually look like PROPERTY-69A58F6F-DD3B-478D-B5EF-09A16BD0C548.

To create an embeddable autotext from its key surround the key with inequality signs: <PROPERTY-69A58F6F-DD3B-478D-B5EF-09A16BD0C548>, then insert this text into the chosen text field.

 

Example


API_Guid guid;

if (!ClickAnElem ("Click on a slab to acquire its area.", API_SlabID, nullptr, nullptr, &guid)) {
    WriteReport_Alert ("No slab was clicked!");
    return;
}
else {
    WriteReport ("Slab clicked!");
    GS::HashTable<GS::UniString, GS::UniString> properties{ GS::HashTable<GS::UniString, GS::UniString>() };
    GSErrCode err = ACAPI_Goodies (APIAny_GetPropertyAutoTextKeyTableID, &guid, &properties);
    if (err == NoError) {
        if (properties.ContainsKey (GS::UniString ("Area"))) {
            GS::UniString area = properties.Get (GS::UniString ("Area"));
            GS::UniString value;
            err = ACAPI_Goodies(APIAny_InterpretAutoTextID, &area, &guid, &value);
            if (err == NoError) {
                WriteReport ("Area is: %T", value.ToPrintf ());
            } else {
                WriteReport ("Autotext for Area could not be resolved.");
            }
        } else {
            WriteReport ("Autotext key for Area could not be found.");
        }
    } else {
        WriteReport ("Error while retrieving the property autotext key table.");
    }
}

 

Requirements

Version: API 21 or later
Header: APIdefs_Goodies.h

 

See Also

APIAny_InterpretAutoTextID
APIAny_GetAutoTextKeysID
APIAny_GetAutoTextsID
APIAny_SetAnAutoTextID
ACAPI_Goodies
API Functions