cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Way to get the Value of a SingelChoiceEnum in a API_Property?

Joel Buehler
Enthusiast

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? 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Viktor Kovacs
Graphisoft
Graphisoft

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.

View solution in original post

2 REPLIES 2
Solution
Viktor Kovacs
Graphisoft
Graphisoft

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.

it worked! thank you very much!! 

 

JoelBuehler_0-1689574571948.png