<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change Value of singleEnumVariant in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225063#M3733</link>
    <description>Thank you very much &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
    <pubDate>Fri, 17 May 2019 09:40:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-17T09:40:58Z</dc:date>
    <item>
      <title>Change Value of singleEnumVariant</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225061#M3731</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I'm trying to change individual properties in Archicad. This is no problem with text fields, but I fail with SingleEmu.&lt;BR /&gt;&lt;BR /&gt;prop is my API_Property Object and chaning value with singlevariant works flawless just by changing uniStringValue&lt;BR /&gt;
&lt;PRE&gt;					GS::Array&amp;lt;API_SingleEnumerationVariant&amp;gt; listOfEnum = prop.definition.possibleEnumValues;
					for (UInt32 i = 0; i &amp;lt; listOfEnum.GetSize(); ++i) {
						API_SingleEnumerationVariant enumerator = listOfEnum&lt;I&gt;;
						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);
&lt;/I&gt;&lt;/PRE&gt;
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&lt;BR /&gt;&lt;BR /&gt;But its not working and i dont get any error code either. Any Ideas?&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;&lt;BR /&gt;Patrick&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:32:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225061#M3731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-04T14:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change Value of singleEnumVariant</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225062#M3732</link>
      <description>Hi Patrick,&lt;BR /&gt;
&lt;BR /&gt;
I think you forgot to set the isDefault flag in the property object to false. If it remains true, than it does not matter how do you change the object because finally the element will still have the default value of the property.&lt;BR /&gt;

&lt;PRE&gt;if (prop.definition.collectionType == API_PropertySingleChoiceEnumerationCollectionType &amp;amp;&amp;amp;
	prop.definition.valueType == API_PropertyStringValueType)
{
	for (const API_SingleEnumerationVariant&amp;amp; enumValue : prop.definition.possibleEnumValues) {
		if (enumValue.displayVariant.uniStringValue == "Teppich") {
			prop.value.singleEnumVariant = enumValue;

			prop.isDefault = false;
			error = ACAPI_Element_SetProperty(Guid, prop);
			break;
		}
	}
}&lt;/PRE&gt;

Regards,&lt;BR /&gt;
Tibor</description>
      <pubDate>Fri, 17 May 2019 08:48:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225062#M3732</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2019-05-17T08:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change Value of singleEnumVariant</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225063#M3733</link>
      <description>Thank you very much &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Fri, 17 May 2019 09:40:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Change-Value-of-singleEnumVariant/m-p/225063#M3733</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-17T09:40:58Z</dc:date>
    </item>
  </channel>
</rss>

