We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2019-05-17 08:45 AM - last edited on 2022-10-04 04:32 PM by Daniel Kassai
GS::Array<API_SingleEnumerationVariant> listOfEnum = prop.definition.possibleEnumValues; for (UInt32 i = 0; i < listOfEnum.GetSize(); ++i) { API_SingleEnumerationVariant enumerator = listOfEnum; auto name_of_value = enumerator.displayVariant.uniStringValue.ToCStr(); API_Guid guid_of_value = enumerator.keyVariant.guidValue; std::string test4 = name_of_value; if (test4 == "Teppich") { prop.value.singleEnumVariant = enumerator; } error = ACAPI_Element_SetProperty(Guid, prop);My naive idea is to rite through the possible enumerators here and as soon as I have found the suitable one (here the entry "Teppich") and then attach this singleEnumVariant to my property I write back
Solved! Go to Solution.
2019-05-17 10:48 AM
if (prop.definition.collectionType == API_PropertySingleChoiceEnumerationCollectionType && prop.definition.valueType == API_PropertyStringValueType) { for (const API_SingleEnumerationVariant& enumValue : prop.definition.possibleEnumValues) { if (enumValue.displayVariant.uniStringValue == "Teppich") { prop.value.singleEnumVariant = enumValue; prop.isDefault = false; error = ACAPI_Element_SetProperty(Guid, prop); break; } } }Regards,
2019-05-17 10:48 AM
if (prop.definition.collectionType == API_PropertySingleChoiceEnumerationCollectionType && prop.definition.valueType == API_PropertyStringValueType) { for (const API_SingleEnumerationVariant& enumValue : prop.definition.possibleEnumValues) { if (enumValue.displayVariant.uniStringValue == "Teppich") { prop.value.singleEnumVariant = enumValue; prop.isDefault = false; error = ACAPI_Element_SetProperty(Guid, prop); break; } } }Regards,
2019-05-17 11:40 AM