2023-07-17 12:33 AM
Hello evryone!
Im having trouble to get the Value of a API_Property, namly of the API_PropertySingleChoiceEnumerationCollectionType.
When i do something like this:
GS::UniString pp = prop.value.listVariant.variants.GetFirst().uniStringValue;
i dont get a value.
even getting the array of values and iterate through the array shows that there are in fact no values stored:
GS::Array<API_Variant> variants = prop.value.listVariant.variants;
im only getting the value when i call the API with "ACAPI_Property_GetPropertyValueString"
the rest of the Collection types, like API_PropertySingleCollectionType is working just fine, like this:
GS::UniString pp = prop.value.singleVariant.variant.uniStringValue
i also tried if archicad writes for no reasons those values directly into the definition. but the definition only gives the answer which options there are and is therefore working as intended.
im using the ACAPI_Element_GetPropertyValuesByGuid call to retrieve the API_Property's
any ideas how to get to the values of an SingleChoiceEnumeration?
Solved! Go to Solution.
2023-07-17 06:50 AM
Single choice enumeration works this way:
- The possible choices are stored in the property.definition.possibleEnumValues array. These are (API_Variant, API_Variant) pairs where the first one is a single guid value, the second one is a single string value.
- The selected choice is stored in property.value.singleVariant.variant.guidValue. This contains one of the guids from the array above so you can find out the actual string value of the selected enumeration value.
2023-07-17 06:50 AM
Single choice enumeration works this way:
- The possible choices are stored in the property.definition.possibleEnumValues array. These are (API_Variant, API_Variant) pairs where the first one is a single guid value, the second one is a single string value.
- The selected choice is stored in property.value.singleVariant.variant.guidValue. This contains one of the guids from the array above so you can find out the actual string value of the selected enumeration value.
2023-07-17 08:16 AM
it worked! thank you very much!!